Javascript/Google Analytics Help?
-
Hey gang – here’s an interesting puzzle:
I’ve upgraded to Universal Analytics.
What I want to be able to do now is track traffic to my site according to the author of each post, the category of each post, and the tags that each post is tagged with.
In other words – show me data for all posts tagged “foo”. In wordpress, all this information is already readily visible in meta tags on each page.
There is something called “Custom Dimensions” that seems to be designed for this. When you create a custom dimension in GA it gives you some code that looks like this:
var dimensionValue = ‘SOME_DIMENSION_VALUE’;
ga(‘set’, ‘dimension1’, dimensionValue);So…
Question #1 – Lets say I’m trying to track Authors. I’m guessing the code should look something like this:
var Author = ‘Mr. Foo’;
ga(‘set’, ‘dimension1’, Author);So the question is – how do I populate “Mr. Foo” with the actual author of the page? How do I tell Google to ignore this if there is no author (like if it’s the front page?)
Question #2 – What happens when I try to track something like category or tag and a post might have dozens of tags?
Any help to solving this greatly appreciated! I’ve been on this for 2 days and have not found a single tutorial that even comes close. I swear I’ll write one if someone can help me get this done…
The topic ‘Javascript/Google Analytics Help?’ is closed to new replies.