DudaMobile + Google Analytics = #Fail
Sometimes I find myself really bothered by 3rd parties who claim to have Google Analytics integrations not take the care to make sure that is done correctly. Indeed, one of those companies is DudaMobile.
image from the DudaMobile site
The strange thing about the DudaMobile situation is that they have some sort of official partnership with Google Analytics. Indeed, when you search for Google Analytics and DudaMobile, there are lots of articles about this relationship out there. I didn’t take much time to read into exactly how this partnership works, but my understanding is that it is different from the actual DudaMobile product.
Let’s take a look at a pizzeria that DudaMobile highlights on their site, see the problem in action first hand, and then I’ll provide the fix.
When I go to Hawthorne’s Pizza from a Google Search, I indeed see the referral information properly reported by Google Analytics.
When I change my user agent, I’m redirected to their mobile site, and my referrer data is lost.
Here’s the utmz cookie:
Things getting even stranger….
And here is where things get even weirder… If you take a look at the template code from DudaMobile, they have some wonky logic where they are calling up to 3 different trackers. And yep, you guessed it, they are calling _setDomainName inconsistently which always leads to problems.
In the Hawthorne’s case, unfortunately, their GA code is not even present on the mobile site. It is supposed to be referenced under externalGaqID. What blows my mind is that if it was indeed there, it shouldn’t even run because _setDomainName is called for a domain that is explicitly incorrect.
I’ve done testing to this regards and have been directly in touch with a top member of the GA developer team about this. Strangely, GA does run even when _setDomainName is called in this manner. I am convinced it is a bug in GA, but an incorrectly defined _setDomainName always used to mean that GA would not execute. So, for users who actually added their GA account number into the DudaMobile backend, forget about self-referrals, they’d see NO DATA. (Barring this anomaly).
Update… I just chatted with my friend @thyng who seems to think that _setDomainName would indeed not inhibit hits from firing in cases where it was declared appropriately once before the improperly called method. In other words, he doesn’t believe it is a bug, but just they way that GA works. I’m still a bit skeptical, but I respect David’s opinion here. Personally, I still think it is buggy behavior because _setDomainName is supposed to help determine GA’s cookies scope. In any case, if _setDomainName is not called correctly to the domain that it is supposed to be set on (i.e. if the _setDomainName doesn’t match document.domain), one thing that will certainly happen is that that particular tracker will spawn a new VISITOR on every hit. As far as DudaMobile goes, that means that visitor and visit counts are being way inflated. #ouch
So let me put this in bold… even with this “referral fix,” GA will still INFLATE the number of visitors and visits to the DudaMobile site for the improperly configured (website owners) tracker.
Back to the referrals…
In any case, I was totally stumped about how to get around this issue for clients since getting DudaMobile to update there GA code seemed like a stretch. (To be fair, I’ve not dealt with them personally, this is just based on client feedback and what I’ve seen in a few forums). The proper thing to do would be to
A). Update the DudaMobile multiple tracker situation so that they have setDomainName called correctly.
B). Capture the document referrer on the client side and pass it to the mobile site
C). Use _setReferrerOverride on the DudaMobile site.
Based upon the Product Forums post, I received a tweet from @Nikalytics
I answered that without DudaMobile’s help, we were stuck. DudaMobile needs to update their GA code.
And then Monica shared a wonderful insight with me
BRILLIANT! I was (am) so excited that I decided that I must blog right away. 🙂 Of course, I hastily tested this, and it does indeed seem to be that functions in the same way that _setReferrerOverride would, except that it can be set in the URL instead over directly in the GA tracking code.
One more thing…
DudaMobile turns off domain hashing since they use _setDomainName(none). This means that all cookies on the mobile.dudamobile.com subdomain are written to the explicit domain AND don’t have a hash. Setting aside the bug that I discussed earlier with _setDomainName not invalidating hits when called for the wrong domain, in the case of users going to multiple DudaMobile sites, their web browser won’t be able to distinguish between the cookies so you might see some really weird referral information from sites your users might not have even visited. As my friend and mentor Caleb Whitmore has told me many times, “make sure that domain hashing is turned on. GA fixed that issue 2 years ago people…”
Analytics shows the reference source with this solution but the keywords entered by users do not appear in the report, these are only displayed in the url. Could it be solved?
Yehoshua Coren says
I’m not sure I understand what you mean. This passes the document.referrer over to DudaMobile. Do you see keywords missing because you’re logged into Google?
yes, I am logged into Google. In the Analytics reports I can see the keys in the URLs but not in the keys report.
I tested your solution on my mobile subdomain of dudamobile and managed to see the reference source of my visits (before ever showing my own domain) now, I just need to see the keywords search of my visitors in Analytics too
Yehoshua Coren says
@e1be810c25d60e53f213d42de27c7758:disqus what is your site?
Yehoshua Coren says
clear your cookies and try again. Google searches look fine to me.
google analytics doesnt show me the keys
Yehoshua Coren says
I will help you offline, instead of back and forth in the comments here.
Hi – sorry, but would you please explain how to do the fix a little more? In my headers I just have
So where can I edit the the redirect_working script itself?
Great blog! I am having the exact same problem, and haven’t heard back from Dudamobile’s support team yet…
I just installed the new js. Hope that works…
Thanks again for sharing the solution!
Update: The script seems to have fixed the referral issue. It says google.com instead my own domain.
However, it shows (not set) for the keywords after 36 visits. Either the 36 visits were from Google users or it is not working for the keywords.
Did I miss something?
Thanks a lot!
Viveta Mentze says
First, I apologize if this discussion is over my head; but it seemed to be the closest to the issues I was having with my site. I have my site working at http://festivals4fun.com and if you check it out on a mobile device it redirects like it should.. the issue is that any of the other pages have urls renamed mobile.festivals4fun.com/#3000 and all the other pages are in this url format. I started going through with my cell phone and going through the pages of all 50 states festivals.. writing down the # + 4-digit number for the url and was going to create a mobile version sitemap for webmaster tools; then I realized that url would have repeats of the same 4-digit numbers (basicially the same url showing on Safari) but somehow rendering different pages; almost like an anchor, even though the content of all those pages weren’t listed on the homepage. Well this is really hurting my website; typing in the regular url for any page but the homepage, the pages will redirect like they should but the content isn’t at that location For instance for The florida page; it redirects like it should to mobile.festivals4fun.com/florida-festivals-and-events/ The problem is that it brings up a Duda mobile error page directing me to the homepage.. The page exists; if I am on the homepage, scrolling through the menu I created it; clicking on the “Top Florida festivals and events” menu button, It brings me to mobile.festivals4fun.com/#2748
So I was contemplating how to get around this; I figured I needed to find all those urls, and create a mobile version sitemap.. Tried some sitemap generators but they didn’t work if I used the mobile.festivals4fun subdomain.. so then I started trying to write them all out by hand from my phone as I mentioned above; and wanted to scream after writing out all 50 urls for each state and saw that some of these urls were exactly identical!
What is going on here, what can I do? I tried calling Dudamobile but they said I couldn’t change the urls; but i really don’t think they understood what the issue was and I got frustrated waiting for them to answer my submitted tickets.. Figured maybe one of you might know what is going on.
Thanks in advance,
I appreciate your post. I’m not very tecchie though. To make your redirect work, where exactly am I putting my url into the code that I get on your link above, and am I then simply putting that code into the head of my site? Also, am I putting this in instead of the Duda supplied redirect? Sorry for the dumb question.
Alex Vallejo says
Can you please put your date on your posts? It’s like my biggest pet peave
Yehoshua Coren says
@alexvallejo:disqus The year and month of the post is fairly clearly located in the URL of the post.
Mark H says
Agreed, I would love to see the dates (not having to look in URL and only see month) because it allows us to understand the recency of your post. Good data por favor 😉
Mark H says
Duda is a great app, but totally sucks in everything else.