Setting Up Google Analytics or Google Tag Manager on your Portals
Google Analytics is a web analytics service offered by Google that tracks and reports website traffic.
To Setup Google Analytics:
1.Log in to your Gmail account or create a new one
2. Go to https://analytics.google.com/analytics/web/ and click Sign Up
Choose “Website” and fill out the details:
- Enter an account name & your portal name
- For the website URL choose https:// and enter yoursitename.orderprintnow.com for the URL
- Select an Industry Category and your timezone
- Click Get Tracking ID & accept terms & conditions.
The next page should look like this:
3. Copy the following code and paste into you Portal’s Custom Javascript box.
Replace the “ENTER-TRACKING-CODE-HERE” text with your own Tracking ID.
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', 'ENTER-TRACKING-CODE-HERE', 'auto');
ga('require', 'displayfeatures');
ga('send', 'pageview');
4. You should now be able to view traffic on your portal in your Google Analytics account.
Google Tag Manager is a tag management system that allows you to create and monitor tags on a user interface.
To Setup Google Tag Manager:
1.Go to https://marketingplatform.google.com/about/tag-manager/
2. Sign up for a free account:
- Enter account name & country
- Enter yoursitename.orderprintnow.com for container name
- Choose Web
- Accept terms & conditions
3. Install Tag Manager:
- Copy the code for the <head> of the page and paste without the <script> tags into the Portal's Custom Javascript.
Ours looked like this:
(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
})(window,document,'script','dataLayer','ENTER-ACCOUNT-ID-HERE');
- We then need to add the script to the body tag.
We chose to add it to the bottom of the footer file (Theme > Footer HMTL) to reduce page bloat upon load.
Under our closing footer tag, we pasted the code so it looked like this:
</footer>
<noscript><iframe src="https://www.googletagmanager.com/ns.html?id=ENTER-ACCOUNT-ID-HERE"
height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>
4. You should now be able to view traffic on your portal in your Google Tag Manager account.