Controlling invitation frequency when using UserReport script and Google Tag Manager

If you want to build your own custom logic when you invite users to take part in the survey, in Google Tag Manager, you can configure UserReport company-centric script to invite users on a certain session or certain pageview. What's more, you can go even further and implement your own logic.

First of all, please notice that the company-centric script needs to be loaded on all page views.

  1. To hide/not show invitation to the survey (inhibit invitation), the following script should be executed before the company-centric script is loaded
    <script>
    window._urq = window._urq || [];
    window._urq.push(['inhibitInvitation']);
    </script>
  2. If you wish to invite users to the survey and the invitation was inhibited, the following script needs to be executed. A user will only be invited if the survey is enabled and the user is not in quarantine. The invitation frequency in the interface can also trigger a none invite. 
    <script>
    window._urq = window._urq || [];
    window._urq.push(['tryToInvite']);
    </script>

 

If you are deploying UserReport company-centric script through Google Tag Manager and you want to implement your own logic when the invitation is shown, then your company-centric script should be configured like this:

Please notice that it's important that the script is configured to run once per page view.

<script>
// UserReport invitations should not be shown until tryToInvite is called in GTM
window._urq = window._urq || [];
window._urq.push(['inhibitInvitation']);
</script>

<script src="//sak.userreport.com/clientId/launcher.js"
id="userreport-launcher-script" async></script>

Then you need to create a rule to show invitation based on dataLayer variables or any other logic.

UserReport exposes the following variables in Google Tag Manager Data Layer:

UserReport exposes the following variables in GTM dataLayer:

  • SessionPageView – pageview number is session
  • TotalPageView – total pageviews on media
  • LastSeenHours – hours since we last saw a current user on this media

Below you can find a step-by-step guide on how to configure invitation to be shown on 2nd pageview:

  1. Go to Variables and create new Data Layer variable with the name SessionPageView

  2. Create Custom HTML tag with name Invite to UserReport and add the following code
    <script>
    window._urq = window._urq || [];
    window._urq.push(['tryToInvite']);
    </script>
  3. In the trigger, press create a new trigger
  4. Create a trigger with type Page View and choose Some Page Views, then select SessionPageView variable and put condition Greater or equal 2
  5. Save the tag

 

Also, you can create variables TotalPageView and LastSeenHours and combine them to define more complex conditions.

 

How did we do?

Chained questions and how they work

How many questions can be added?

Contact