Incorporating Google Analytics


If you wish to track your portals using Google Analytics, you can do so with the following code.



Method
Code
Google Analytics
Use the following code inside your Portal Custom Javascript and replace the indicated text with your tracking code. 

(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');



Google Tag Manager
When using Tag Manager you will be asked to insert one piece of code into the Head of your website and another into the Body. 
The code that belongs in the Head can be added to your Portal's Custom Javascript (without the <script> tags), like so:  

(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');



You then must add the code for your body tag. We recommend pasting this code in your theme's Footer HTML box below the code.

<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>