where in php to put Google Analytics
-
I have the code from Google Analytics but I don’t know where to put it, can anyone help please?
Here are the directions given by Google:
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.
This is your tracking code. Copy and paste it into the code of every page you want to track.<script> (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', 'UA-49310797-1', 'graciamariastudio.com'); ga('send', 'pageview'); </script>
PHP ImplementationOPTIONAL
Create a PHP file (I tried ‘new stylesheet’ but it doesn’t show up in the Editor side bar) named “analyticstracking.php” with the code above and include it on each PHP template page. Then, add the following line to each template page immediately after the opening <body> tag:
<?php include_once("analyticstracking.php") ?>
Im very lost in php, I am slowly learning how to use it though, just be gentle with jargon.
Thanks in advance
- The topic ‘where in php to put Google Analytics’ is closed to new replies.