Post

2 followers Follow
2
Avatar

Create a Google Tag Manager feature in ONTRAPORT

Michael Wray

This is a feature request submitted on behalf of Christopher Anderson by Michael Wray.

One possibility is to able to export the the HTML and manually add the the GTM code. Another possibility is to have the script already included in all pages and just provide a configuration field in your admin interface for someone to enter their GTM account number/container id for you to inject into the script (Magento handles GTM this way).

Given the wide use of GTM by digital marketers and agencies these days, we should support it!

Completed

Official comment

Avatar

Our client Sunil Jaiswal found a way to modify the ONTRAPORT tracking script, available in Administration > Get Tracking Code, to work in Google Tag Manager (GTM). This allows GTM to insert the tracking script into any page you are already tracking with Google. 

Use this script:

<script>
(function(o,n,t,r,a){
a=o.getElementsByTagName('head')[0];
r=o.createElement('script');r.async=1;
r.onload= function() {_mri=n;_mr_domain=t;mrtracking();};
r.src='https://optassets.ontraport.com/tracking.js'
a.appendChild(r);
})(document,'99999', 'XXXXXXX.ontraport.com' );
</script>

In the next to last line replace '99999' with your account  ID number and 'XXXXXXX.ontraport.com' with your subdomain. You can find these in the tracking script located at Administration > Get Tracking Code; here's an example using my account with the account ID and subdomain in bold:

<script src='https://optassets.ontraport.com/tracking.js' 
type='text/javascript' async='true' onload='_mri="83383",
_mr_domain="acumensales.ontraport.com",mrtracking();'></script>

 

Frank Hagan
Comment actions Permalink

Please to leave a comment.

1 comment