How to not track mobile redirects in Google Analytics
-
If a user is on a mobile device and comes to our home page, http://www.darden.virginia.edu/web/Home/ they are redirected to http://m.darden.virginia.edu/web/Home/. We want a way to remove all the redirects from our Google analytics reports. More specifically we do not want to include the the page view of http://www.darden.virginia.edu/web/Home/ in our page view count when the user is on a mobile device. How do we do that?
-
Hi There,
Well there are two ways to approach this problem:
- The rightest way to fix the problem is to implement a server side redirect system, rather than a JavaScript redirect (client-side). This is best practice for mobile redirects, and the way that a majority of the sites on the web do it.
The reason why you're getting those first pageviews is because the GA snippet has time to fire before the user is redirected to mobile. With a server-side redirect, no HTML is loaded, so the GA snippet never fires.
2a) The sort-of hacky way to fix this would be to apply filters that exclude mobile visits from your reports. It'd be wise to create a new profile, though, so you still have the mobile device traffic for analysis in your regular profiles.
2b) Another hacky fix: Suppress the GA snippet when a mobile device is detected. You could adapt the logic you have in place that redirects mobile users to the mobile site to the GA snippet. For example:
var deviceMatch = navigator.userAgent.match(/Blackberry/i) || navigator.userAgent.match(/Symbian/i) || navigator.userAgent.match(/iPhone/i) || navigator.userAgent.match(/iPod/i) ||navigator.userAgent.match(/Android/i);
if (!deviceMatch && $.cookie('full_site')) {{Fire GA}
}
All that said, the 2nd options are NOT the right way to go about things. Option 1 is definitely what should be done.
Mike
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
-
Google Analytics Goals - Button Tracking
Does anyone know if there is a really easy way to track a button in Google Analytics yourself? It seems that most button click goal setups involve some use of tricky code and I'm wondering if there is a much easier way to do this that will allow us to simply setup and track certain button clicks as goal conversions in Analytics. Your help here is much appreciated!
Reporting & Analytics | | Gavo0 -
Google Analytics Question - Impressions & Queries Up, Sessions Down
I'm working with a client who, according to the Google Query report, impressions and sessions are up since we've started work with them about 6 months ago, but Google sessions are down. In moz, we're seeing a gradual, but steady increase in search visibility specifically with Google. Note: this is all organic. From when we started tracking queries, the first month we were tracking there were 43,581 impressions and 690 click throughs for the month. This past month there were 98,293 queries and 1015 clicks throughs for the month (granted not year over year data) - of these 1,015 clicks, 995 of them were from web. However, for those same time periods, sessions from Google are down over 30% - 1,750 vs. 1,189. I'm not sure how to interpret this. I realize that clicks and sessions are not a straightforward comparison, but I would think that if clicks were up according to the query report that sessions would also be up. Is it that some of these clicks are bouncing and therefore not being tracked as a session? Is there a potential issue with how data is being tracked?
Reporting & Analytics | | Corporate_Communications0 -
How can we stop Google analytics pulling in data from another site?
We have a few accounts under one Google login. They all have separate Google analytics codes but one of the sites is somehow pulling in some data from another site but the other site has not got the same analytics code on it. Not sure how this is happening and what we can do about this, is it a bug in the Google Analytics system? Any help would be appreciated.
Reporting & Analytics | | dentaldesign0 -
How to track click on phone number on mobile device in GA as a goal?
Hi, I work with a lot of physicians and one of the things I'd like to do is add a goal in GA so we can try to track how many visitors are clicking the phone # to call the office from smartphones. Would doing this be as straight-forward as adding a the standard javascript click text that I'd add for an external link? And Is there a way to make a goal only "count" if the user-agent is a smartphone? Because if I attach the JS to the phone #, it's going to be in all of the HTML regardless of which device is used. Unless of course, I mess with the CSS to only make the javascript code appear on certain stylesheets. Thank you!
Reporting & Analytics | | Titan5520 -
Alternative to Google Analytics
Hey Everyone, My company has just changed the order processing software we are using and it's causing some issues with Google Analytics conversion funnel tracking. Specifically, there is one point in the funnel where making certain selections (which about half the people do) causes the page to reload. Also, on the login/register page, if they miss a field, the software tells them missed the field, but loads a new page which has a different URL which is not a part of the funnel when a mistake like that isn't made. All of this is causing Google Analytics to report people as leaving the conversion funnel when they really haven't. About a third of the traffic is being shown as exiting the funnel with the exit URL being the exact same URL as the step they are supposedly exiting from (example: the visitor enters on page1, moves to page2, Google is showing that they exit on page2 and go to...page2. Does anyone have any suggestions of how to deal with this in Google Analytics? If not, do you have a recommendation of an alternative analytics program which can deal with the situations mentioned above? PS - Changing the way the checkout software works does not appear to be a viable option. Kurt Steinbrueck
Reporting & Analytics | | Kurt_Steinbrueck
OurChurch.Com1 -
Google Analytics set up for non-canonicalized domains
Our client's website is non-canonicalized (www.example.com & example.com load the same thing). Google seems to have made a preference for the www, but canonicalizing to www breaks their Flash website. All we're really trying to do at this time is install Google Analytics for them. What's the smartest way to make sure that both www.example.com and example.com are treated exactly the same by Google Analytics? Google Developers: Domains & Directories states that by default visit data will be separately collected between the two domains, although I found no references to the common www/naked domain issue. In stackoverflow: Does google analytics combine naked domains with the www subdomain? Török Gábor says, "Yes, users will be tracked, but the same visitor coming from www.datalookups.com and datalookups.com will be counted as two different visitors." On the same page, Open SEO says, "This is completely false: www.domain.tld and domain.tld are treaded just the same, and get the same value for the HASH code (the number at the start of each __utm cookie). This an exception: every other subdomain.domain.tld will be handeld as a distinct web site". Can any Analytics experts help me sort this out? Thanks!
Reporting & Analytics | | GOODSIR0 -
Where are google analytics stats for iphone4
hi We were looking at the Google Analytics for one of our sites and noticed that there were NO pageviews from device=iphone and resolution=640x960 in the report. Given that iphone4 is supposed to be 640x960, and would be the most popular device (at least in our offices and everyone I know), it seems wierd. I sorted the Mobile Devices report by device and resolution to see what was available. The first 160 results were all device=not set. Finally got to device=iPhone and there were three entries: resolution 0x0 had 11 views resolution 320x396 had 45 views resolution 320x480 had 3,944 views. Hopefully all iphone4 users havent been classified as not set. Or is it possible that iphone4s claim to be 320x480 in browsers, as per http://www.alistapart.com/articles/a-pixel-identity-crisis/ Even worse, if I look at the Samsung Galaxy S II (myown phone), there are over 30 screen resolution combinations. Does anyone have anything to shed on this? I asked about it on the google analytics twitter account last week but havent had a response. Are there other analytics solutions that would distinguish between the iphones? Warning - this is a link to a large image, with the not set stats at the top. 6Sjji
Reporting & Analytics | | ozgeekmum0 -
Nofollow page is being reported as a landing page for organic search in Google Analytics
One of my client's websites includes a series of pages for an enrollment process. All of these pages are blocked by robots.txt. In Google Analytics these pages are showing data as landing pages for organic search traffic, and have been for quite some time. There was recently a surge of organic search traffic landing on one of these pages, coming from multiple search engines. The pages appear to be blocked and I'm not finding any of them in the search results for the keywords that are being reported in GA or by searching for the url. Does anyone have any insights into why this might be happening?
Reporting & Analytics | | rgibson1000