Controlling invitation frequency when using SAK and Google Tag Manager

If you want to build your own custom logic when you invite users to take part in the survey.

This configuration can be handled in the Google account manager to configure SAK script to invite users on a certain session or certain pageview.

However, you can go even further and implement your own logic.

There are a few things you need to be aware of.

  1. SAK script needs to be loaded on all page views
  2. To hide/not show invitation the following script should be executed before SAK script is loaded
    <script>
    window._urq = window._urq || [];
    window._urq.push(['inhibitInvitation']);
    </script>
  3. To invite the user to survey, if the invitation was inhibited(like above). The following script needs to be executed. A user will only be invited if the survey is enabled, the user is not in quarantine. The invitation frequency chosen in the interface can also trigger a none invite.
    <script>
    window._urq = window._urq || [];
    window._urq.push(['tryToInvite']);
    </script>

When you deploy the SAK script through Google Tag Manager and you want to implement your own logic on when the invitation is shown, your SAK script should be configured like this:

It is 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 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 complicated conditions.

 

 

Attachments

Comments

Powered by Zendesk