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
-
Strange 404 Pages Appearing in Google Analytics
Hi, My client has some strange urls appearing in GA which lead to error pages. Please see the following image: https://imgur.com/a/6TPO8yL e.g URLs like /h/6445738.html I've used screaming frog to see if these pages exist on the website and I can't find them, anywhere. Therefore how are they coming up in GA? If anyone could please help I'd really appreciate it.
Reporting & Analytics | | SolveWebMedia0 -
Google Analytics Set-Up for site with both http & https pages
We have a client that migrated to https last September. The site uses canonicals pointing to the https version. The client IT team is reluctant to put 301 redirects from the non-secure to the secure and we are not sure why they object. We ran a screaming frog report and it is showing both URLs for the same page (http and https). The non-secure version has a canonical pointing to the secure version. For every secure page there is a non-secure version in ScreamingFrog so Google must be ignoring the canonical and still indexing the page however, when we run a site: we see that most URLs are the secure version. At that time we did not change the Google Analytics setup option to use: "https" instead of "http" BUT GA appears to be recording data correctly. Yesterday we set up a new profile and selected "https" but our question is: Does the GAnalytics http/https version make a difference if so, what difference is it?
Reporting & Analytics | | RosemaryB1 -
Determining Exact Reverse Path in Google Analytics
Within Google Analytics does anyone have suggestions for how to determine the exact reverse path for a product purchased? The goal funnel does not provide in a detailed way, especially if a step is taken out of the exact funnel provided. If this information cannot be obtained through Analytics is there another tool we can use to get the exact path?
Reporting & Analytics | | bozzie3110 -
Mobile Site on Google Analytics
Hi mozzers, We just launched a mobile site and I was wondering what are the main steps to follow for gettting your mobile site tracked via GA (m.example.com)? We have a profile for www.example.com GATC: javascript or PHP to install? Should the profile be on a subdomain? What else to consider when implementing a mobile site on GA? Thanks
Reporting & Analytics | | Ideas-Money-Art0 -
Solid Place to learn intermediate-adbanced Google Analytics
Hello Everyone, I've been using Google Analytics for some years now, and I never really used it in an advanced way (alerts, goals, conversions, etc...) I was wondering if there was a good place for me to learn GA so I can start using it to it's full potental. Thanks Zach
Reporting & Analytics | | Zachary_Russell0 -
Transferring Google analytics accounts
Hi, Does anyone know if you can transfer an Google Analytics account. We are looking to take over a new clients existing website and the analytics account is registered to their current web designers. Is it possible to transfer it to the client so that their existing web company no longer has access and they keep all their historical data, or do we have to start from scratch. Thanks Fraser
Reporting & Analytics | | fraserhannah0 -
Does using Google URL Builder override original source in Google Analytics?
During a free trial on Tatango, we send daily emails to customers to give them advice, resources, etc. We started using Google URL Builder http://www.google.com/support/analytics/bin/answer.py?answer=55578 to create individual links in each of these emails, but when the customer purchases a subscription now, the source in GA isn't Google, Facebook, Twitter, etc. they are all showing up as the source we created using the URL builder for each email. Does Google URL builder override the original source in Google Analytic?
Reporting & Analytics | | Tatango0 -
Google Analytics - Intelligence Custom Alerts
When you add an intelligence custom alert does it look at the history and backdate issues? I've added a few custom alerts, even basic ones like my homepage gets 5 views, create an alert. I either need to wait a day or something is going wrong. Cheers.
Reporting & Analytics | | Seaward-Group0