Deploy tracking script with Google Tag Manager
2 min
You can use a tag management system like Google Tag Manager (GTM) or OneTrust to deploy the tracking script.
Configure GTM
- Create a tag – In your GTM workspace, go to Tags and click New.
- 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>- 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.
- Save and publish – Save the tag and publish the changes in your workspace.
Configure OneTrust
- Go to scripts – Go to Websites in your OneTrust dashboard. Select your site, and open the Scripts tab.
- Add a script – Click Add New and paste the tracking script in the Custom Script field.
- 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.
- Publish – Save and publish your changes.