Frequency control with GTM

To ensure the data quality of your survey sample, we recommend using the standard UserReport implementation, where UserReport makes sure not to invite the same users again and again.

However if you for some reason wish to trigger the survey on the second pageview instead of at the entry of the user, Google Tag Manager (GTM) can be set up to achieve this.

You can read more about the general implementation of UserReport in GTM in this guide. You will need to have to tags active. The one described in the guide, and a new tag to set up only inviting users on the 2nd pageview you need to follow these steps:

  1. First of all go to the 'Variables' screen and create a new User Defined Variable. Choose 'Data Layer Variable'

  2. You then need to choose which variable to use for your trigger logic. UserReport sends two variables you can use. Either 'SessionPageView' which is number of page view during a the active session or 'TotalPageView' which is the total number of pageviews across sessions by the same user.
    Remember to set a name for your variable.



  3. Now create a new trigger from the list on the left side of the page.
    Set a name for the trigger and select Event as 'Page View'.
    For the option 'Fire On' choose 'Some Page Views'. 
  4. Three fields will now pop up. First choose the Variable you just created - in this instance 'PageviewBySession'. Next select 'greater than or equal to' 2. 



  5. Final step is to create the tag which will fire the survey invitation.
    When you create this script select HTML tag. Enter a name and paste this code in the 'Configure Tag' field:

    <script type="text/javascript">
    window._urq = window._urq || [];
    _urq.push(['tryToInvite']);
    </script>


    Select 'Fire On' Some Pages and in the pop up select the variable you just created.


  6. As stated in the intro to the guide, you still need the tag described in this guide as well. Although you need to change it a bit (changes in red):
    <script type="text/javascript">
    window._urq = window._urq || [];
    _urq.push(['inhibitInvitation']);
    _urq.push(['initSite', 'xxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx']);
    (function() {
    var ur = document.createElement('script'); ur.type = 'text/javascript'; ur.async = true;
    ur.src = ('https:' == document.location.protocol ? 'https://cdn.userreport.com/userreport.js' : 'http://cdn.userreport.com/userreport.js');
    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ur, s);
    })();
    </script>

When you publish your changes to your website you will now only invite users on the second pageview.

 

Attachments

Comments

Powered by Zendesk