I'm working on a Wordpress blog entry, with a particularly tricky feature incorporated into it.
Quite simply, the post is a social experiment to examine which of two links are more likely to be clicked.
Two links will be posted to Twitter.
One will be advertised as something like "JUSTIN BIEBER ANNOUNCES RETIREMENT! example.com/WHATEVER1"
The other will be advertised as "DO YOU WANT TO MAKE THE WORLD A BETTER PLACE? example.com/WHATEVER2".
Both of these links will redirect to the same page - the page of the blog entry - and this blog entry will have 2 counters, one recording the number of clicks for each link, and then a discussion comparing the interest in Celebrity gossip to the interest in humanitarian values.
The issue is found in trying to incorporate this. The requirements for this, as far as I can see, are that:
I thought of several ways to achieve this, but all had some flaws.
1: Use two separate html frames in the post to two separate click recording sites. This means that the information must be publicly available, requiring no more than the tracking code.
2: Use a Wordpress plugin that interacts with the GA API. - No plugins are available that track link clicks, only page hits (that I could find).
3: When the link is clicked, it goes to a custom page in my domain (outside of Wordpress), which runs a script increasing a ticker stored on the domain (in a txt file, I would guess), and then redirects to the blog page. The blog page then uses html to read from that text file and displays that value.
So the question then is, what is the best option? 1: Is there some way around this frame issue? (It could then be done by public Google Analytics.) 2: Is there a plugin I missed that could achieve this? 3: If all else fails, is this third option possible, and if so, how difficult would it be to implement?
Trigger a javascript event to google analytics for tracking. You should just be able to use the onclick event similar to this.
GA Event Tracking + onClick="document.location.href='
Googles documentation https://developers.google.com/analytics/devguides/collection/gajs/eventTrackerGuide