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 SEO Queries Not Showing
Hi All, This might be a silly question, but for all the properties I monitor in Google Analytics, I'm now showing no data for SEO Queries under Acquisition for the past 6 days. Normally I would expect a few day delay in queries, but nothing for 6 days is somewhat peculiar especially as it was functioning fine prior to November 12th. Does anyone have insight into what might be going on? Thanks! URaNMa3
Reporting & Analytics | | amichaels0 -
Showing Button Clicked in Google Analytics - How to check which button has been clicked?
For my E commerce site in my google analytic in Event Action it is showing "Button Clicked" and Total Events 4005, so i want to know visitors have clicked on which buttons?
Reporting & Analytics | | bkmitesh0 -
Using Filters On Google Analytics
Hi Guys, I am In need of some technical help with regards to Google analytics. One of my clients has a site providing HR Software on SaaS basis. The users login via the site for the various HR Tools. Obviously this is skewing the analytics data and showing 10,000+ extra visitors that actually don't exist. Now I understand i can add filters and exclude certain pages for instance the login page, however, some users will visit the home page then click login. How can I exclude them just to show new visitors to the site rather than users that are just trying to login. Hope this makes sense Neil
Reporting & Analytics | | nezona0 -
Switching Google Analytics from Urchin to GA
I want to finally make the switch from Urchin to GA in Analytics, but the Google support page is no longer working (I realize I'm late to this so they likely took it down/moved it to where I can't find it). I've been searching on Google but can't find a straightforward guide to changing that won't disrupt my data. Anyone have a link to a working guide, or can you provide some guidance?
Reporting & Analytics | | Axios_Systems0 -
Analytics package beside google analytics
Hi, What analytics package can i use to track ecommerce transaction besides gogole analytics that is free of charge? Thanks Arthur
Reporting & Analytics | | VivaArturo0 -
Un-link Google Analytics
I have set the wrong account/password details for one of my campaigns. How do I 'step back' and choose the correct settings please? Thanks Ian
Reporting & Analytics | | driansmith0 -
Custom Variables to track Vimeo plays on website with Google Analytics?
Hello Everyone, I'm trying to track how many times a Vimeo video is played on my site via GA. Does any of you have any knowledge of how can this be achieved? I've read the documentation and came up with this: After the iframe embed i insert this: Of course the GA is loaded in the header. Does not work, at least i cant see anything in analytics. I have set up the segment as per the attached image. Thanks in advance! Alex E6XnO.png
Reporting & Analytics | | pwpaneuro0 -
Google Analytics should track users from iPhone App
Hi Mozzers, you say there are no dumb questions, here is one. We've build an iPhone App for our Website working-dog.eu. So users can read there new messages with ease when they are out of the office, read about breeds, ... do all the nice stuff they want. I don't think so, but is it possible to track these users with Google Analytics? When the come via App, the Analytics code will not run for them. But maybe it could start an AJAX request or something like this? But how should the code run, without a browser which can interprete JavaScript? So, in short: Is it possible to track users from iPhone App with Google Analytics? Kind regards Patrick
Reporting & Analytics | | mdoegel0