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
-
Modify Google Analytics Script To Only Cookie U.S. Sessions
I know I can filter sessions from outside the US, but is there a way to modify the GA script so that it doesn't cookie visitors to a site if they are from outside the US? Note, this is separate from having a cookie consent opt-in. Thanks in advance,
Reporting & Analytics | | FitzSWC
Fitz0 -
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 -
Goal Tracking In Analytics On Separate Ordering Website
I have a question for any Google Analytics wizards out there. We have two clients that have a similar complication when it comes to tracking goal conversions in Analytics. Basically, all the conversion actions we want to track occur on a separate website; either an iframe embedded on the page or through an entirely different ordering website. Trick is, Analytics sees the source for all these conversions as referrals from the main site. We'd like to get visibility back to the original source/medium that brought visitors to the site before they converted. Anyone have a suggestion for making that happen?
Reporting & Analytics | | fivefifty0 -
How to find goo.gl/ URLs in Google Analytics
Hello! How does one go about finding the impact of goo.gl/ shortened URLs in Google Analytics? (I know I should be using Campaigns, but this was for an old project.) Thanks in advance! Erik
Reporting & Analytics | | SmileMoreSEO0 -
Domain Sub folder tracking from Google webmaster tool
I have created separate google webmaster access for this sub folder http://lineonebus.com/content/ Original domain http://lineonebus.com/ Search results in webmaster shows no search queries though this subfolder created in wordpress is ranking for some keywords.
Reporting & Analytics | | csfarnsworth1 -
If I install google Analytics, that can affect my SEO.?
I purchased a site that has a lot of Backlinks and when I started to make changes like installing google analytics! i suspect the performance in search engine was getting worst because of that, so I removed.
Reporting & Analytics | | pparma
Now I'm trying MOZ and needs GA, should I install it again??
Maybe it analyces the backlinks and tells google, I don't know, is that possible?0 -
How to Track Google Local Places in Google Analytics?
I have read many articles on how to track google local places through google analytics. Each article I have read show a different way of setting up google analytics and using tags in google local places. Wondering if anyone as up to date information on this and what would be the best practice to track data from google local lisitngs in google analytics Thanks Arthur
Reporting & Analytics | | VivaArturo0 -
How to track what people type on my text boxes on Google Analytics?
Hi there! In our website, we have a few text boxes that users need to use to complete the goal. The boxes aren't search boxes, but it's still important to us to track what people type on it. I'm looking for a way to track the data through the "event" feature in Google Analytics, but it seems that this tracker can only calculate clicks, or video views etc. Does anyone knows how to track do it?
Reporting & Analytics | | ivan.precisodisso0