Analytics
3K members online now
3K members online now
Dive into multiple domain (Cross/Sub) tracking, implementing Ecommerce and Enhanced Ecommerce, setting up Event tracking, and Universal Analytics code.
 
Guide Me
star_border
Reply

Where to add my Tracking Code for Website - wordpress

Visitor ✭ ✭ ✭
# 1
Visitor ✭ ✭ ✭

 

I have changed my theme so am assuming tracking code from my last theme was removed - now google Analytics isn't reporting any sessions etc - I have also double checked this on Real Time overview and nothing coming up when i test my website. 

 

I have followed online instructions and added the Tracking Code to my Theme's - header.php. Is this the correct place?

I see online that most say to paste after <header> BUT i have no <header> coding within my header.php template? 

Am i also supposed to paste this code on more than one page or will this do my whole website? 

 

Thanks! 

1 ACCEPTED SOLUTION

Accepted Solutions
Marked as Best Answer.
Solution
Accepted by topic author Rebecca H
November 2016

Where to add my Tracking Code for Website - wordpress

Participant ✭ ✭ ✭
# 4
Participant ✭ ✭ ✭

Yes, you should copy-paste your tracking snippet that you decide to use on every web page on your site you wish to track. A header is the best place for that because GA tracking code is asynchronous, meaning that the browser doesn't need to wait for the code to finish loading to continue rendering elements that come after it on the page. It means that you can safely put the code at or near the top of your page.

If the code is toward the end of the page and the page takes a significant amount of time to load, it's possible that the user could navigate away (click a link or close the browser window) before the tracking code has loaded, meaning you would miss capturing data about that pageview.

 

Hope this helps.

Taavi

 

View solution in original post

Where to add my Tracking Code for Website - wordpress

[ Edited ]
Participant ✭ ✭ ✭
# 2
Participant ✭ ✭ ✭

Hi Rebecca,

 

It's better to use some kind of plugin for that. I would recommend using this plugin: https://wordpress.org/plugins/header-footer/

 

It works well and you can easily add your Google Analytics code in the <head> section. If you're planning to use this plugin, you should remove GA code from your header.php.

 

Hope this helps. Let us know how it goes.

Taavi

 

 

Where to add my Tracking Code for Website - wordpress

Visitor ✭ ✭ ✭
# 3
Visitor ✭ ✭ ✭

Thanks Taavi, 

 

Is it best to add my tracking code to <head> "on every page"?

 

Marked as Best Answer.
Solution
Accepted by topic author Rebecca H
November 2016

Where to add my Tracking Code for Website - wordpress

Participant ✭ ✭ ✭
# 4
Participant ✭ ✭ ✭

Yes, you should copy-paste your tracking snippet that you decide to use on every web page on your site you wish to track. A header is the best place for that because GA tracking code is asynchronous, meaning that the browser doesn't need to wait for the code to finish loading to continue rendering elements that come after it on the page. It means that you can safely put the code at or near the top of your page.

If the code is toward the end of the page and the page takes a significant amount of time to load, it's possible that the user could navigate away (click a link or close the browser window) before the tracking code has loaded, meaning you would miss capturing data about that pageview.

 

Hope this helps.

Taavi

 

Where to add my Tracking Code for Website - wordpress

Visitor ✭ ✭ ✭
# 5
Visitor ✭ ✭ ✭

Great! Thanks for your help Smiley Happy 

 

Where to add my Tracking Code for Website - wordpress

Visitor ✭ ✭ ✭
# 6
Visitor ✭ ✭ ✭

Hello Taavi,

 

Can you advise how I can track my widget adds on my wordpress site. I have uploaded them as images then added them through widgets. Thanks

Where to add my Tracking Code for Website - wordpress

Participant ✭ ✭ ✭
# 7
Participant ✭ ✭ ✭

Hi @Catherine K,

 

Let's discuss it in another topic. Smiley Happy

 

I noticed that you already discussed that with Arnold he gave you a good advice.

Let's continue this conversation there: https://www.en.advertisercommunity.com/t5/Google-Analytics-Tracking-Goals/Google-Analytics-for-widge...

 

Thanks,

Taavi

Where to add my Tracking Code for Website - wordpress

Visitor ✭ ✭ ✭
# 8
Visitor ✭ ✭ ✭

He has not replied back to last question and I was stuck that is why I came here

Where to add my Tracking Code for Website - wordpress

Visitor ✭ ✭ ✭
# 9
Visitor ✭ ✭ ✭

Dear Taavi

 

Please help me out - I have a Word Press Blog, but know absolutely nothing about tracking codes and codes in general, and where to start with this.

 

Your assistance will be greatly appreciated

 

Kind regards

 

Ruth Katz

Johannesburg, South Africa