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

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

Deploy Tracking Script via Tag Manager

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

Deploy Tracking Script via Google Tag Manager

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

Google Tag Manager Setup

  1. Create a New Tag: In your GTM workspace, navigate to Tags and click New.

  2. Configure the Tag:

    • For the Tag Type, choose Custom HTML.
    • In the HTML field, paste the tracking script. 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:

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

OneTrust Setup

  1. Navigate to Scripts: In your OneTrust dashboard, go to Websites, select your site, and navigate to the Scripts tab.
  2. Add a New Script: Click Add New and paste the tracking script into the Custom Script field.
  3. Categorize the Script: Assign the script to a consent category (e.g., "Performance & Analytics Cookies"). The script will only fire if the user has given consent for this category.
  4. Publish: Save and publish your changes.