Before setting up your Regular in-app campaign scripts, please make sure you have customized and reviewed your other campaign settings, such as: the survey template, campaign audience and schedule, notifications and workflows. Click here to learn how.

The last step is to install the in-app scripts in your web instance. You will find them in the Setup tab. There are two scripts and both are highly important for your campaign to work.

1. Customer data script

<div
    id="retently-survey-embed"
    data-href="
https://app.retently.com/api/remote/tracking/5a3a34e99c5bc9bb72acb5b7"
    data-rel="dialog"
    data-campaign="regular"
    data-email="INCLUDE CUSTOMER EMAIL ADDRESS HERE" // mandatory
    data-firstname="INCLUDE CUSTOMER FIRST NAME HERE" // optional
    data-lastname="INCLUDE CUSTOMER LAST NAME HERE" // optional
    data-company="INCLUDE CUSTOMER COMPANY NAME HERE" // optional
    data-tags="INCLUDE CUSTOMER TAGS, IF ANY AVAILABLE, HERE" // optional. Separate multiple tags with comma
></div>

This script will be used to identify your customers. Every time a customer logs in to their account on your web platform the script should be automatically populated with their data. Here are the fields that will contain customer information: 

  • data-email (mandatory): Include email address here.
  • data-firstname (optional): Include first name here.
  • data-lastname (optional): Include last name here.
  • data-company (optional): include customer’s company name here
  • data-tags (optional): Include customer’s tags here

IMPORTANT! The data-tags field is optional, but it plays a major role when setting up your in-app campaign, especially if you’re considering to run multiple campaigns or want to survey only a specific segment of customers.

The data-tags is directly related to your campaign’s Audience tab. If you have selected in your Audience to survey all customers, then no matter what tags you have included in the data-tags field, the customer will still be matched with that campaign and surveyed based on the schedule.

However, if you include one or more tags in the data-tags field, then keep in mind that the customer will match and be added only to a campaign that has the same tags selected in the Audience tab.

2. Survey embed script

<script type='text/javascript'>
 (function (d, s, id) {      
     var js, rjs = d.getElementsByTagName(s)[0];      
     if (d.getElementById(id)) return;      
     js = d.createElement(s);      
     js.id = id;      
     js.src = "https://app.retently.com/public/components/embed/sdk.min.js";              
     rjs.parentNode.insertBefore(js, rjs);
 }(document, 'script', 'retently-jssdk'));
</script>

This script will embed the in-app survey in your web instance. It will match the customers you have identified with an in-app campaign in your Retently account. The script is also responsible for triggering the in-app survey in your web platform. Do not change any data in the script.

Both scripts should be included on the webpage where you want to have the survey triggered on. Include both scripts between the <body> tag on the page, as in the example below:

<!DOCTYPE html>
<html>
  <head>
    <title>In-app Script setup example</title>
  </head>
  <body>

    <!-- START WEBPAGE CONTENT -->

    <div class="container">
    <h1>This is your webpage</h1>
    <p>We recommend you to include the in-app script after all your     main content on the webpage.</p>
    </div>

    <!-- END -->

    <!-- START RATENTLY IN-APP SCRIPTS -->

    <div
    id="retently-survey-embed"
    data-href="
https://app.retently.com/api/remote/tracking/5a3a34e99c5bc9bb72acb5b7"
    data-rel="dialog"
    data-campaign="regular"
    data-email="INCLUDE CUSTOMER EMAIL ADDRESS HERE" // mandatory
    data-firstname="INCLUDE CUSTOMER FIRST NAME HERE" // optional
    data-lastname="INCLUDE CUSTOMER LAST NAME HERE" // optional
    data-company="INCLUDE CUSTOMER COMPANY NAME HERE" // optional
    data-tags="INCLUDE CUSTOMER TAGS, IF ANY AVAILABLE, HERE" // optional. Separate multiple tags with comma
></div>

    <script type='text/javascript'>
 (function (d, s, id) {      
     var js, rjs = d.getElementsByTagName(s)[0];      
     if (d.getElementById(id)) return;      
     js = d.createElement(s);      
     js.id = id;      
     js.src = "https://app.retently.com/public/components/embed/sdk.min.js";    

     rjs.parentNode.insertBefore(js, rjs);
 }(document, 'script', 'retently-jssdk'));
</script>

    <!-- END -->

  </body>
</html>
Did this answer your question?