Skip to main content

Google Tag Template Integration

Overview#

Rokt’s ability to match referrals to conversion events can drastically improve your campaign performance. Using the template for Google Tag Manager, you can configure the Rokt snippet without needing to change the code on your page. Once installed, the template accesses the data layer and event triggering to match referrals to conversion events.You can configure the template to include a variety of attributes related to conversion.

Setup#

  • Create a new Template

    • Choose Templates from the relevant Google Tag Manager Container.
    • Select new

    Test GTM

  • Click Import and select the Rokt Integration Tag Template .tpl file. If you don't have your Tag Template file, check with your Rokt Account Manager.

    Test GTM

    • click save

    Test GTM

  • Configure the Tag template, setting up the data attributes and firing rules.

    • Choose Tags and select New

    Test GTM

    • Name the tag “Rokt Tag Template”, then select Tag Configuration.
    • Scroll to the Custom section and choose the Rokt Tag Template.

    Test GTM

  • Configure your account details and preferences

    • Enter your Rokt Account ID, provided by your Rokt account manager.
    • Ensure the sandbox checkbox is selected.
    • Choose to enable either Rokt Ads or Rokt Ecommerce, according to your account manager.
  • Configure your data attributes.

    • For each of the attributes click the add icon beside the text box to expand the list of attributes in your data layer.
    • Choose the appropriate variable in your data layer for the appropriate field. For example, click the add icon for the email field and then select the correct email variable in your data layer.

    Test GTM

    • Once connected you should see your variable name appear in the input box (see circle #1 in the image below).
    • If the appropriate variable is not showing in your data layer check out our documentation on setting up attributes in the Google Tag Manager data layer here, and check with your Rokt account manager for next steps.

    Test GTM

  • Configure a trigger to determine when the Rokt Tag Template should fire. Click on Triggering rules to add one.

    • If your webapp is a Single Page Application (Created with React, Angular, Vue, ...) Click the plus on the top right and then choose a trigger type of History Change.

      Test GTM

      • Change the trigger firing rules to “Some History Changes”.
      • Change the condition to Page URL contains and enter the URL provided to you by your Rokt account manager.
      • Click Save.

    Test GTM

    • If your webapp is not a Single Page Application, Click the plus to create a new trigger, name it and choose a trigger type of Page View.

      Test GTM

      • Change the trigger firing rules to “Some Page Views".
      • Change the condition to Page URL contains and enter the URL provided to you by your Rokt account manager.
      • Click Save.

    Test GTM

  • Save the Rokt Tag Template.

    Test GTM

Testing#

  • Select the Rokt Tag Template and choose Preview.

    Test GTM

  • Enter your confirmation page URL (for example, this url) and choose Connect.

  • A new window will open with the Tag Assistant.

  • Open developer tools and inspect network activity by right clicking any part of the page and clicking Inspect.

  • Go to the network tab in the panel that opens up and reload the page (cmd/ctrl + R).

  • In the search panel search ‘domain:*.rokt.com’.

    Test GTM

  • If there are search results, i.e. items that appear, then that confirms the template has been set up. Reach out to your Rokt account manager to let them know the template has been implemented and tested with successful results.

  • If the results are blank like the image below step 6, then it hasn’t been properly configured. Reach out to your Rokt account manager for further guidance.

Was this article helpful?