chrissky
unread,Jul 1, 2010, 1:03:23 PM7/1/10Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to google-analytics-api - GA Data Export API
First, my apologies for a long posting. And I apologize for posting to
the API group if the issues turn out this is not API specific.
Yesterday and today I did a test for a client who needs some
"multidimensional" link tracking. The approach used was to have
an onclick handler invoke async tracking with an event and with
custom variables. Two test pages were deployed with test links:
<a
href="pdf/doc1.pdf"
onclick="_gaq.push(
['_trackEvent', 'Literature','Download PDF', 'doc1', 11],
['_setCustomVar', 1, 'Type', 'Factsheet', 3],
['_setCustomVar', 2, 'Role', 'Financial Advisers', 3],
['_setCustomVar', 3, 'AssetClass', 'Bond', 3],
['_setCustomVar', 4, 'FundRange', 'fr1', 3]
);" >Factsheet 1</a>
<a
href="pdf/doc2.pdf"
onclick="_gaq.push(
['_trackEvent', 'Literature','Download PDF', 'doc2', 12],
['_setCustomVar', 1, 'Type', 'Factsheet', 3],
['_setCustomVar', 2, 'Role', 'Individual', 3],
['_setCustomVar', 3, 'AssetClass', 'Equity', 3],
['_setCustomVar', 4, 'FundRange', 'fr2', 3]
);" >Factsheet 1</a>
The second test page also has two test links. Page names are gatest1
and gatest2.
I clicked around a bit on both pages and then ran this query (in
ShufflePoint):
SELECT
METRICS ga:totalEvents,ga:uniqueEvents
DIMENSIONS ga:pagePath,
ga:eventCategory,ga:eventAction,ga:eventLabel
FROM 13844713
WHERE
TIMEFRAME yesterday
FILTER ga:pagePath =~ "gatest"
Page Path, Category, Action, Label, Total, Unique
/gatest1, Literature, Download PDF, doc2, 3, 1
/gatest1, Literature, Download PDF, doc1, 4, 2
/gatest2, Literature, Download PDF, doc4, 1, 1
/gatest2, Literature, Download PDF, doc3, 2, 1
If I also query the custom variables:
SELECT
METRICS ga:totalEvents,ga:uniqueEvents,ga:eventValue
DIMENSIONS ga:pagePath, ga:customVarValue1, ga:customVarValue2,
ga:customVarValue3, ga:customVarValue4, ga:eventCategory,ga:eventLabel
FROM 13844713
WHERE
TIMEFRAME yesterday
FILTER ga:pagePath =~ "gatest"
The results are
Page Path, Var Value 1, Var Value 2, Var Value 3, Var Value 4,
Category, Label, Total, Unique,
/gatest1, Factsheet, Advisers, Bond, fr1, Literature, doc2, 3, 1
/gatest2, Factsheet, Advisers, Swap, fr1, Literature, doc4, 1, 1
So, adding to the query any custom variable dimension (doesn't matter
which) drops the row count to two and all clicks made on the first
links in the pages are no longer reported. But note that the variables
returned are those for the FIRST link.
My assumption is that it has to do with the variable scoping, but I am
having a hard time understanding the results.
On day two, I click the links in the reverse order (in each page,
clicked 2nd link the first). The results returned now have rows for
the first links in the document. But note again the variables are
mismatched - the values are for the second link.
Page Path, Var Value 1, Var Value 2, Var Value 3, Var Value 4,
Category, Label, Total, Unique
/gatest1, Factsheet, Individual, Equity, fr2, Literature, doc1, 1, 1
/gatest2, Factsheet, Institutional, Equity, fr2, Literature, doc2, 1,
1
I'll start with the obvious question. Is this the expected behavour as
far as Google is concered? Two behavours that don't make sense to me
are:
1. Events are dropped if you ask for custom variables
I would have expected to get both events but always get the first (or
second) variable value
2. Events and variables are not in sync
For the events not dropped, I would have expected to get the variables
associated with the link tag.
Again, apologies for the long post. Hopefully it is a useful topic for
others facing similar reporting tasks.
- Chris