Analytics Academy
6.9K members online now
6.9K members online now
Guide Me
star_border
Reply

Tracking Code Placement

Visitor ✭ ✭ ✭
# 1
Visitor ✭ ✭ ✭

hi, i have a doubt about where is the correct place to put the tracking code.

On Developer site it´s says

"The code should be added near the top of the <head> tag and before any other script or CSS tags" (link)

 

But, on the academy,  it's says

"Make sure that you place the tracking code immediately before the closing </head> tag on your website" (link)

 

On Assessment 1, for question 10, by Developer site, for me, the first question is correct, but by academy, the second is. Which one is correct? if this question shows in GAIQ Exam, which one it will consider correct?

 

 

10. Where in the HTML of your webpage should you place Analytics tracking code?

 
- Just after the opening <head> tag of your website
- Just before the closing </head> tag of your website
- Just after the opening <footer> tag of your website
- Just before the closing </footer> tag of your website
 
 

 

 

1 Expert replyverified_user

Tracking Code Placement

Top Contributor
# 2
Top Contributor

 Tha analytics academy courses are used as a study guide for the GAIQ exam, so I would follow what the Analytics Academy teachings say to do.

Bronwyn Vourtis, Google Analytics Top Contributor
Was my response helpful? If yes, please mark it as the ‘Best Answer.’ Learn how here

Tracking Code Placement

Visitor ✭ ✭ ✭
# 3
Visitor ✭ ✭ ✭

Hi Bronwyn,

 

The current video of Lesson 1.3 - Google Analytics for Beginners states that the JS tracking code should immediately follow the <head> tag on every page. Also, below the video/demo section it states "Note that the Analytics tracking code has changed. It is now recommended that you include the tracking code directly after the opening tag in your HTML. Please see the links at the end of this lesson for more information."

 

However, there is no date to say when that change was made.

 

I am assuming that the information in the current lesson is newer than the question and your response above...correct? I just want to be 100% sure I have the right information. In other words, the right answer to the question quoted by Luiz Y. is now as follows:

 

10. Where in the HTML of your webpage should you place analytics tracking code?

- Just after the opening <head> tag of your website

 

 

Tracking Code Placement

Top Contributor
# 4
Top Contributor

Hi @Tracey C :-)

Yes, you are correct. It now gets placed just after the opening <head> tag.

 

The current version Global Site Tag gtag.js was still in beta as of Aug 2017 and 

it got rolled out very shortly after that with very little public mention of it.

Analytics.js is still supported at this time

Bronwyn Vourtis, Google Analytics Top Contributor
Was my response helpful? If yes, please mark it as the ‘Best Answer.’ Learn how here