Google Tag Manager
These instructions are for asynchronous tracking only. Using Google Tag Manager to apply site changes can lead to poor site performance. Instead, the snippet must be placed directly in the site head, according to these installation instructions.
Installation
SKIP THIS STEP if you want to track conversion goals on the site you are already optimizing (e.g. www.yourcompany.com
) via the standard snippet installation.
To track conversions on a site (e.g. app.yourcompany.com
) for which you
are not using Sumatra to apply site changes, you may follow the steps below to install
the tracking portion of the snippet via GTM.
In your Google Tag Manager workspace, select Tags → New → Custom HTML.
Copy-Paste the following:
<script type="text/javascript">
!function(){var sumatra=window.sumatra=window.sumatra||[];sumatra.methods=["load","track","enrich","ready","personalize","optIn","optOut","registerAnalyticsSource","addEnrichmentCallback"],sumatra.factory=function(t){return function(){sumatra.push([t].concat(Array.prototype.slice.call(arguments)))}};for(var t=0;t<sumatra.methods.length;t++){var r=sumatra.methods[t];sumatra[r]=sumatra.factory(r)}sumatra.loadJS=function(e,t){var r=document.createElement("script");r.type="text/javascript",r.async=!0,r.src="https://cdn.sumatra.ai/v1/sumatra-sdk.min.js";var a=document.getElementsByTagName("script")[0];a.parentNode.insertBefore(r,a)},sumatra.loadJS(),
sumatra.load("SUMATRA_API_KEY", "https://api.sumatra.ai")
sumatra.track('page');
}();
</script>
Be sure to replace SUMATRA_API_KEY
with your API key. The can be found on the Settings tab after logging in to Optimize.
For Trigger, select All Pages (or choose a specific path to track goals only on a single page, such as /signup
).
Tracking Goals
With the tracking snippet installed, you can configure custom goals by following the instructions here.