Monday, August 6, 2012

Google Analytics: onMouseDown tracks more events than onClick

Recently I added some Google Analytics event tracking code to some very simple web forms across a number of sub-domains. The forms took just one field, an email address, and I placed the tracking code in the onClick event, as suggested by Google in their online documentation:
<input type="submit" onClick="_gaq.push(['_trackEvent','Subscribe','By Email','Subdomain 1']);" value="Subscribe" />
I then set about testing the forms to make sure they were tracking. Despite submitting each form at least once only 2 events were tracked. I knew that the clicks had occurred as not only was I given on screen confirmation but I received emails to let me know I had subscribed.

This is what GA was telling me for all events across all subdomains:
Despite GA knowing that 42 visits sent events only 21 were actually tracking. Strange.

Then I discovered this interesting article by Joze Uzcategui of Cardinal Path, who did an experiment to determine whether onMouseDown records a different number of events to onClick. Turns out it does.

OnMouseDown records the click as soon as the visitor starts pressing the mouse button, whereas onClick occurs after the button has then been released again. The theory is that today's super-fast browsers allow the page to unload before the onClick event has been registered. (This may be confirmed by the fact that Jose's stats showed a greater discrepancy for Chrome, Safari and Firefox than for IE.)

Jose's results were staggering. Of 235 visits, 205 onMouseDown events were recorded whereas onClick tracked a mere 122. For IE there were 5% more onMouseDown than onClick events tracked. For Firefox, this increased to 36% and for Chrome it was an astounding 84%.

This raises some interesting questions, not least where should I be recommending clients place their tracking code. Clearly it doesn't make sense to place tracking code in both events, unless you are somehow going to distinguish between them, as Jose did in his experiment. But as another reader pointed out, it may be a common and valid action for a visitor to begin to click, then change their mind and move the mouse to another part of the screen before releasing the button. I know I do this. OnMouseDown would register this as an event, when it clearly isn't. However,one could argue that having a few extra events recorded is a small price to pay to prevent so many potentially real events being ignored. Sure, GA has told me that 42 visits sent events but if I know nothing about half of these events, not even which sub-domain they came from, then what use is that to me?

Possible solutions are to:
  • Track both onMouseDown and onClick, making sure to use your labels or categories to differentiate between the two. You would still need to figure out how to use the resulting data though, perhaps taking an average to account for any mouse depress-drags.
  • Add a time delay to all events, similar to the recommended solution for outbound links.This would be imperceptible to the visitor but should delay the event for long enough for GA to track it before the page unloads.
  • Use onMouseDown instead of onClick and accept that there may be some false events recorded. Perhaps perform some user tests to determine the percentage of actions that can be assumed to be depress-drags.

I ran a quick test using IE and in the time it has taken me to write this post the event was showing in GA - this is a record for all the testing I've done across these sites so far. Just to confirm, gobsmacked as I was, I repeated the test on a further 3 sub-domains that had previously failed to track. Sure enough, those events also appeared in GA in record time. So, to be sure I tried the first one again in Chrome. Of course, just to make this a totally moot point that event turned up quick-smart too. I've since submitted 3 more forms from Chrome and 1 from IE; 2 of the Chrome forms haven't yet tracked. Clearly I have a lot more testing to do.

Friday, May 11, 2012

Google Analytics: Paid Search Advanced Segment excluding some google / cpc traffic

Can anyone out there explain why the following might be happening?

Earlier today I viewed a Google Analytics Ecommerce report for a client and found a revenue that was about 0.2% less than what I was expecting it to be. Not much, you might think but when the revenue is over $100,000 it's enough to make me curious.

I viewed the revenue report by clicking on Standard Reporting, Conversions, Ecommerce and Overview:


I then selected a source/medium of google / cpc to get the Adwords revenue:


And this was the figure that was slightly less than expected. Further investigation showed that I had inadvertently applied an Advanced Segment of Paid Search Traffic.



The question is, why should this make a difference? What could be coming through as google / cpc that the Paid Search Traffic segment is filtering out? Please leave a comment if you have any ideas about what could be causing this discrepancy.

Friday, May 4, 2012

HP Software prevents GIMP from working

PROBLEM:
Running GIMP on my HP laptop (ProBook 4520s running Windows 7) causes the following error:
"The procedure entry point libintl_setlocale could not be located in the dynamic link library intl.dll"

GIMP does not start up properly.

CAUSE:
According to GIMP this is caused by the placement of a file named intl.dll in the Windows or Windows\System32 folder causing conflicts with GIMP's intl.dll. The file in the system folder takes precedence, preventing GIMP from starting up correctly.

In my particular case the offending file was placed there by software loaded as standard onto HP laptops, HP Protect Tools Security Manager. 


SOLUTION:
Rename or remove the intl.dll file in the system directory.

You might want to think twice about this if you use the software responsible for placing the file there. By all means rename and see whether you get any warnings or errors in any of the programs you run. I didn't use the HP software; in fact I found it quite annoying. Two programs in particular use this file: DPAgent.exe and DPAdminWizard.exe. Renaming the file intl-old.dll caused two error messages to display when I booted up my laptop:


I got rid of these by going into Services and changing the Startup Type from Automatic to Manual. I'm sure that uninstalling the software would be just as satisfactory.

I'm glad I didn't spend the time configuring HP's Protect Tools only to then have to stop running it. According to GIMP "intl.dll has no place in System32 directory". I will refrain from any further comment, except to say that this is not the only thing that irritates me about my HP laptop; USB ports to the front do not make sense.

Friday, April 20, 2012

Google Plus-ing my blog

As part of my drive to use social media to publish my blog - and thus encourage me to write more content - I am adding some share buttons to the page. So far I've only used the built-in Blogger gadgets, due to a shortage of time. They're not bad but I'm thinking of adding a custom widget that should look a bit better.

But to get to the point, I can't decide whether to have a Google +1 button, or a Google Badge, which allows you to follow me from the site. Or both. (Note, I already have a +1 button below each post but here I'm talking about the left-hand panel). What do you think?

Thursday, April 19, 2012

Spooky Facebook requests phone number and recommends friends

At work we have a lot of clients that we "Like" on Facebook to help them with their social media profiles. Some of these clients I'm personally interested in and others not so much. My news feed is becoming very cluttered as a consequence.  A colleague suggested setting up a second Facebook profile that can be used for professional purposes. This appeals to me as I don't particularly want to share my "Child vomited on shoulder" stories with colleagues and business associates. I also want to start messing around with promoting this blog a bit more to further my knowledge within the work environment.

So I set about setting up a new profile, with a more professional photograph, using my work email address.

I was surprised to find that Facebook wanted my mobile phone number in order for me to continue with my registration. Not only that but I was warned that I could only register this number with one account. I was pretty sure that back in 2007 when I first signed up to Facebook this wasn't a requirement so I wasn't concerned that my mobile number was already registered. But I was concerned that I might need to associate this number with my primary account at some time. And of course, I was a bit worried about what they might do with the number once they have it. Concern Number One. I hesitated.

Then the Social Media expert in the office assured me they only wanted it for the creation of the account and that I could change it later. Cool. I continued.

I then received a text message with a code I was required to submit in order to continue my account creation. This I did, then made sure that Facebook wasn't going to send me any SMS messages or give out my number.

The next page blew me away.

I was asked to select friends from a list which included a mixture of good friends, an old uni friend, ex-colleagues, my dad, girls I knew in pregnancy yoga over three years ago, my husband's aunt, and a friend of a friend I haven't seen for years.

It was an eclectic list to say the least. Some of them I am already friends with, using my primary account, others I'm not, although we do have one mutual Facebook friend. I do know all of them. How does Facebook know this? Concern Number Two.

Whilst pondering this aloud the aforementioned Social Media expert (affectionately and hereafter referred to as Salmon) muttered something about Facebook being able to access my iPhone SMS database. Eh what? Say again? Concern Number Three.

"Oh yes," said the all-knowing Salmon. "If you have the Facebook app on your phone, and you have given Facebook your phone number then they can access your message bank. They got into trouble for not disclosing it. Google it."

And how come you didn't think to mention this earlier oh wise Salmon? Anyway I did. Google it.

And I found this. To summarise for those who can't be bothered to click on the link, Facebook login credentials are not encrypted within the mobile apps and as such can be exploited by a rogue app, or anyone with a USB connection to your phone. The developer who discovered this found a Facebook access token inside a game app. He copied the token and using Facebook Query Language managed to pull any information he desired from his Facebook account. I urge you to follow the link and read the article. What happened next almost beggars belief. Concern Number Four.

I also found a link to an article regarding the eavesdropping on text messages. The article only references Android phones and Facebook denied it. But still. By now I'm getting rather concerned. And totally spooked.

How did Facebook know that I knew those people? All I had told it was my work email address, my phone number, my name (minus my married name) and my date of birth. These are not generally people I have emailed from work. I couldn't see any way it could have linked me to my primary account or to any of those people. I started to get concerned that it had read my phone Contacts list but not all of the suggestions were in there. It was like magic! A dark and scary magic.

Here's my current theory. We use GMail for email at work and I have my Google accounts set up so that I can log in to both my work and personal accounts within the same browser session. (This is an excellent feature which is really useful for GMail but then falls apart when you want to use some Google apps, such as Documents.) So Google knows both my work email address and my personal email address and that they both belong to the same person. As we've already established Facebook knows my work email address. Well, my primary Facebook account has my personal GMail account as a secondary email. Could this be how Facebook knows I probably know those people? Could it be looking at my personal GMail contacts and then seeing if any of them are on Facebook, and then suggesting either them, or their friends? Or could it be that because I have emailed myself from work it is suggesting my own primary Facebook account's friends and their friends? It seems convoluted but I'm otherwise stuck for an explanation. Let me know in the comments if you have any ideas.

Meanwhile, I think I will sack the whole idea of a second account and I'm rethinking heavily how I use my primary one.