- This topic has 7 replies, 3 voices, and was last updated 5 years, 4 months ago by
Tom.
-
AuthorPosts
-
January 10, 2017 at 8:00 am #262587
Karim
Hello Tom,
I am having an issue with: https://www.rbdakgootreiniging.nl
I wanted to add the universal tracking code to track Google analytics. Instead of adding it to each page seperatly i wanted to use the GP Hooks. So i implemented the code in the wp-head section, but then i saw the code from the front side of the site(see link for attachment), and after deleting the code totally, i keep seeing this small piece of code still from the frontside above the header(see other attachment)
I had to restore a backup eventually.
What did i do wrong to get the universal tracking code working?
http://i65.tinypic.com/2em3qkk.jpg
http://i63.tinypic.com/wb6wzc.jpgJanuary 10, 2017 at 9:06 am #262604Roberto Enrique
You should add the tracking code inside
<script><!--your google tracking goes here--></script>
tags.
I do this very frequently.January 10, 2017 at 9:42 am #262620Karim
Hello Roberto,
Thanks for the reply sir:)
So, i can use the GP Hooks “wp-head”?
And if i understand you correctly, my code will look like this:
<script><!–<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’,’https://www.google-analytics.com/analytics.js’,’ga’);ga(‘create’, ‘UA-11111111-16’, ‘auto’);
ga(‘send’, ‘pageview’);</script>–></script> tags.
It starts with 2 times <script> and ends 2 times with </script> ?
This is new for me
Thanks again
January 10, 2017 at 9:46 am #262622Roberto Enrique
not really, mine looks 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','https://www.google-analytics.com/analytics.js','ga'); ga('create', 'UA-XXXXXXX-1', 'auto'); ga('send', 'pageview'); </script>
where did you get your code from?
This is where i pick it from analytics dashboard:
January 10, 2017 at 9:54 am #262628Karim
Yeah, i also took my code from there, but i thought i had to put the code inside the code you sent in the previous comment.
This is what my code looks like from my universal code:
<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’,’https://www.google-analytics.com/analytics.js’,’ga’);ga(‘create’, ‘UA-xxxxxx-16’, ‘auto’);
ga(‘send’, ‘pageview’);</script>
But when i pasted this code in the wp_head hook i got the problem i started this topic with
January 10, 2017 at 10:09 am #262639Tom
Lead DeveloperLead DeveloperIf you copy the code exactly as it is when Google gives it to you, you won’t have this issue.
It needs to be inside
<script></script>
tags, but only one set of them.Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/
Ongoing Development: https://generatepress.com/ongoing-developmentJanuary 10, 2017 at 1:43 pm #262718Karim
I did it again, and now it seems to work well. I have no idea what went wrong the 1st time.
I thanks you both alot:)
Cheers
January 10, 2017 at 6:49 pm #262775Tom
Lead DeveloperLead DeveloperGlad we could help 🙂
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/
Ongoing Development: https://generatepress.com/ongoing-development -
AuthorPosts
- You must be logged in to reply to this topic.