Installing Google Analytics tracking code on Landing Pages
-
Hello,
I have my landing pages located on a separated subdomain (LP.example.com).
I've created a new property in Google Analytics for that subdomain. My question is:
- where do I have to place the GA tracking code ? in the header ? before I close the tag or before I close the tag ?
I have another issue: I've placed the GA Tracking code on some pages in the way below:
in the body tag of that Landing page HTML Code I added this line: -
Hi Joni, thanks for your question! You've received some great replies! Did any of them answer your question? We'd love an update, thanks.
Christy
-
Hi Folks,
My apologies the recommendation only applies to Google Tag Manager (GTM)
https://developers.google.com/tag-manager/quickstart
I would never recommend anyone to use just GA/UA with scripts unless they are a developer and even if they are they should recognise the advantage of using GTM. With GTM there is no need for putting GA/UA scripts directly on the page/site unless its eCommerce or something very cutsom. Anywho thats my two cents, I hope Joni got sorted.
Dave
-
I agree stick with what Google says keep it in the header
- Paste your snippet (unaltered, in it’s entirety) into every web page you want to track. Paste it immediately before the closing tag.
If your website uses templates to generate pages, enter it just before the closing tag in the file that contains the the section.
- Paste your snippet (unaltered, in it’s entirety) into every web page you want to track. Paste it immediately before the closing tag.
-
Hi!
I'm sorry to disagree with you Dave, but actually, in most cases you need to place your analytics script just before the tag to be more accurate.
You can see the set up for GA tracking code in Analytics Help: https://support.google.com/analytics/answer/1008080?hl=en.
Also, if you want more background information, here the guys from Luna Metric have written an excellent article that details where to put the GA snippet and why.
Hope it helps!
-
Hi Joni,
The GA tag ALWAYS goes just inside of your opening body tag () and it differs again for eCommerce with the page needing to be loaded before events are reported to GA. Try the search terms "ga tag body" and you will get a few links that will make it crystal clear where it goes.
I would also strongly advise you to look at using Google Tag Manager (GTM) over a standard analytics setup especially if you don't have a development background.
I wouldn't be overly concerned with Wappalyzer not seeing the GA code but its not a good sign. I would recommend using the Google Analytics debugger for Chrome/Firefox to do any debugging of GA tags.
Dave
-
You want to place the regular Google analytics JavaScript in right above the body tag.
If it is the new universal Google analytics I believe it must be in the head to work properly. However when you are actually copying the code they give you a you can read the directions and then what I suggest doing is going over whatever part of the site they reference for instance if it states this tag must be in between the
<header>and <header>tags copy the tag, then use the command + F on a Mac or control +F on a PC in order to find the tag that they suggest you place it above or under. It will either be in the header or above the body tag.
Hope this helps,
Thomas</header> </header>
Got a burning SEO question?
Subscribe to Moz Pro to gain full access to Q&A, answer questions, and ask your own.
Browse Questions
Explore more categories
-
Moz Tools
Chat with the community about the Moz tools.
-
SEO Tactics
Discuss the SEO process with fellow marketers
-
Community
Discuss industry events, jobs, and news!
-
Digital Marketing
Chat about tactics outside of SEO
-
Research & Trends
Dive into research and trends in the search industry.
-
Support
Connect on product support and feature requests.
Related Questions
-
UTM Links Showing Up as Separate Pages in Google Analytics
Hey everyone, I was just looking at landing pages in Google Analytics, and in addition to just the URL of the landing page, the UTM links are being listed as separate pages. Is this normal? I anticipated seeing the landing page URL and then using the secondary dimension to see source/medium. If this isn't normal, what would I check next?
Reporting & Analytics | | rachelmeyer0 -
Increase in Direct traffic, drop in Google traffic, after updating Google Analytics settings.
I made some changes to our Google Analytics property settings (see notes in screenshot). As a result, there was an equal drop in Google traffic and increase in Direct traffic. Has anyone else seen something like this before? I'm wondering if I should revert. jE7buO6
Reporting & Analytics | | vcj0 -
Google Tag Manager Tracking
We have Google Tag Manager set up to track our website https://kontenta.co.uk/ Although we have a blog - https://kontenta.co.uk/designroom/ I'm just wondering if it's better to track the sites separately? If so, how do I add the blog to tag manager? Does it need setting up as a filter to match the regular expression https://kontenta.co.uk/designroom/* We just need to figure out the best way to measure both the website and blog traffic and if users are coming from the blog to the site, and what interactions they are making. Thanks
Reporting & Analytics | | Jseddon920 -
I want to take down some pages, how do I inform google?
Hey Guys, I'm hoping someone can help - I'm in the midst of a site re-design - whilst one of our biggest reasons for the redesign was to create more space to write valuable content and unique content I have been reading other posts on moz about content auditing. I have come across a few articles in my own blog that are from 250 - 300 words to which the articles seem similar and the traffic is low. I'm wondering while I'm left to consolidate these articles and create a fresh article for each entry that is more in-depth, when I consolidate or delete these pages - do I need to inform google these pages have now been deleted? If so using Wordpress what is the best way to do this? Cheers and would appreciate some advise Thanks
Reporting & Analytics | | edward-may0 -
E-commerce data import Google Analytics
Hi there, Since a few weeks we have started a cooperation with a big online wholesale company which now sells our products. I want to import simple E-commerce data: amount of transactions and revenue. More detailed data such as amount of products, name of products, etc. is not necessary in the first place. Now I discovered the 'data import' functionality in Google Analytics but I can't find any suitable option for E-commerce data import. The data from the wholesale company is gathered in a nice export in a separate system, so there should be a way ti import this data into Analytics. Could anybody help me with this? Any advice is welcome! Thanks in advance.
Reporting & Analytics | | MarcelMoz
Marcel0 -
E Commerce and cross domain tracking on universal analytics?
Hi Mozzers, I am running into an issue where my client's website ( can refer to domain.com) uses a third party checkout site called rezovation that we can refer to checkout.rezovation.com: I went through this doc here https://developers.google.com/analytics/devguides/collection/analyticsjs/cross-domain and https://developers.google.com/analytics/devguides/collection/analyticsjs/ecommerce (for universal analytics) and I still find it confusing so here are my questions: According to my understanding I need a customized GATC to link both domains checkout.rezovation.com and domain.com? If yes(above), do we setup one customized GATC for cross domain tracking on all pages from checkout.rezovation.com and domain.com? if it is the case can someone provide detail steps on how to set it up ( I am not a coder so the easier the guideline, the better) Once cross domain tracking is set up, e commerce tracking code should be only on thank you page should be looking like the image below? Should i add manually all the extra code for the ecommerce tracking code or I can get it done via a third party website? Thank you guys! oPgn8P4.png
Reporting & Analytics | | Ideas-Money-Art0 -
Google Analytics Showing Inflated Product Revenue
Hi- For the month of Feb on two of our sites we are seeing inflated product revenues. I have not seen this before and I am not having any luck searching for answers. Here is the issue: Product B sells for $159.95 For the month of Feb we sold 3 thus revenue should be ~$479.85 GA is showing Product B's revenue at $3,360.00 I read online that sometimes folks will bookmark the receipt page and that can cause this and we would need to put a catch in place for this but I am guessing this is not the case as it is happening on two sites. Please let me know if you have any questions.
Reporting & Analytics | | K2_Sports0 -
Analytics/Google Keyword comparison
Hi I'm trying to establish a methodology to best show the gap between potential and realised organic keyword traffic. To obtain potential keyword traffic I'm using the Google Adwords keyword tool to derive local monthly search volumes for exact keyword matches. However, I'm confused as to which is the best way of getting a comparable metric from Google Analytics (GA). I was using custom reports and the 'organic searches' metric. However, this provides different values to a standard report selecting non-paid search in the default advanced segments. What is the best report/metric in GA to use for both organic and paid search volumes that would be comparable to the Google Adwords keyword tool. Also, I'm having problems getting my kids to eat their greens, any advice! 😉 Thanks Neil
Reporting & Analytics | | mccormackmorrison0