Disclaimer: This website requires Please enable JavaScript in your browser settings for the best experience.

HomeDev GuideAPI Reference
Dev GuideAPI ReferenceUser GuideDev CommunityOptimizely AcademySubmit a ticketLog In
Dev Guide

Deploy tracking script with Google Tag Manager

Deploy Content Recommendations tracking using tag management systems like Google Tag Manager or OneTrust for flexible script management.

You can use a tag management system like Google Tag Manager (GTM) or OneTrust to deploy the tracking script.

Configure GTM

  1. Create a tag – In your GTM workspace, go to Tags and click New.

  2. Configure the tag – Complete the following:

    • Select Custom HTML from the Tag Type drop-down list.
    • Paste the following tracking script in the HTML field. Ensure you replace the placeholder values.
    <script type="text/javascript">
        var _iaq = [
            ['client', 'YOUR_CLIENT_ID'],
            ['delivery', YOUR_DELIVERY_ID],
            ['track', 'consume']
        ];
    </script>
    <script async src="//s.{region}.idio.episerver.net/ip.js"></script>
  3. Configure the trigger – Complete the following:

    • Click Triggering and select All Pages to load the script on every page.
    • Create a new trigger with the type Page View and set conditions based on the Page URL or Page Path to track specific pages.
  4. Save and publish – Save the tag and publish the changes in your workspace.

Configure OneTrust

  1. Go to scripts – Go to Websites in your OneTrust dashboard. Select your site, and open the Scripts tab.
  2. Add a script – Click Add New and paste the tracking script in the Custom Script field.
  3. Categorize the script – Assign the script to a consent category, like Performance & Analytics Cookies. The script will only fire if the user gave their consent for this category.
  4. Publish – Save and publish your changes.