-
Author
Tagged: analytics
-
December 2, 2014 at 15:00 #37311pihlaParticipant
I attached analytics code to the javascript code section in general theme settings, but it does not work, analytics can not find the code.
I attached the code like this:
<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-57267937-1’, ‘auto’);
ga(‘send’, ‘pageview’);</script>
And also tried
(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-57267937-1’, ‘auto’);
ga(‘send’, ‘pageview’);neither is working.
I tried also to put the code in the header.php and footer.php files, but they did not work. I even tried to make an own .js file and attached that into header, but it did not work.
Can you tell me what is wrong? Analytics says that it can not find the code in my sites homepage.
December 2, 2014 at 17:23 #37331sharmstrModeratorHmmm. I’m using analytics the way you’re trying to do it. You definitely have to wrap it with <script> tags like you have in your first example. You say google cant find it, but have you looked at your page source? Right click on any page, crt F to find GoogleAnalyticsObject.
Also, verify that you dont have fancy quotes. They are present in the code examples you provided, but that could be this site doing that when you pasted it here.
Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solutionThis support site is not about custom work. If you need custom development please contact cornel@seventhqueen.com
-
AuthorPosts
The topic ‘Cant get analytics to work’ is closed to new replies.