We would like use Google Analytics in one of our websites that use Valence. We will need to add the Google Analytics code in the header tags in every page of the site. For dynamic content, it suggests that we use a common include or template to paste the tracking code instead of manually adding it to every page.
To pass our website data to Google Analytics, I will need to add the google analytics tracking code to every page. GA assigns a tracking ID for the website. I’ve pasted below the info GA has on how to put the tracking code onto the website:
For example: the tracking ID is UA-54516992-1.
Website tracking
This is the Universal Analytics tracking code for this property.
To get all the benefits of Universal Analytics for this property, copy and paste this code into every webpage you want to track.
PHP Implementation
Use the code above to create a file named "analyticstracking.php", and include the file on each PHP template page.
Add the following line to each template page immediately after the opening <body> tag:
Dynamic Content Implementation
Use a common include or template to paste the code above instead of manually adding it to every page.
Any suggestions? Should I use the Hook.js – maybe put code in beforelogin, beforelogout, launchapp, close app, etc events? Where would I include this in the actual home/landing/login page?
Thanks,
Maria
To pass our website data to Google Analytics, I will need to add the google analytics tracking code to every page. GA assigns a tracking ID for the website. I’ve pasted below the info GA has on how to put the tracking code onto the website:
For example: the tracking ID is UA-54516992-1.
Website tracking
This is the Universal Analytics tracking code for this property.
To get all the benefits of Universal Analytics for this property, copy and paste this code into every webpage you want to track.
PHP 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','https://www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-54516992-1', 'auto');
ga('send', 'pageview');
PHP Implementation
Use the code above to create a file named "analyticstracking.php", and include the file on each PHP template page.
Add the following line to each template page immediately after the opening <body> tag:
HTML Code:
<?php include_once("analyticstracking.php") ?>
Use a common include or template to paste the code above instead of manually adding it to every page.
Any suggestions? Should I use the Hook.js – maybe put code in beforelogin, beforelogout, launchapp, close app, etc events? Where would I include this in the actual home/landing/login page?
Thanks,
Maria

Comment