How can I query Google Analytics condition on TWO different dates?

263 views Asked by At

I wish to extract (via the Analytics Core Reporting API) all the transactions made TODAY by users that had a specific ga:eventCategory few weeks ago. I'm looking to see the date of a transaction and all dated of event that are related to that transaction. If GA was sql I would join by the ga user and take in the dimension both his transactions date and his dimension update date... Thanks. Noam.

1

There are 1 answers

0
Eike Pierstorff On BEST ANSWER

Like I have indicated in my comment you can segment the data to include only those users who have the specific event. Segmentation works fine with the core reporting API.

Your segment defintion would look like this:

users::condition::ga:eventCategory==[myEventCategory]

(where obviously the thing in [brackets] is a placeholder that needs to be substituted for the event category name). The "users::" prefix means you are segmenting by user scope (as opposed to sessions), so this will include all sessions in the selected timeframe for users who had the event at least in one of their session (even if the event was outside the selected timeframe).

Select transactionId as dimension and some metric (revenue) and todays date and you are done. Or you would be done if this was actually going to work, but there are at least two caveats:

  • Google Analytics does not work in realtime, so it's unlikely that TODAYs transactions are fully available (Google says it's 24 hours until the data is processed - actually it might happen faster, but you cannot rely on it).

  • If a user has deleted his or her cookie she won't be recognized as a recurring user and GA will be unable to segment her out. The longer the interval between the event and the transaction the less likey it is that the GA cookie is still present.

So even with a technically correct query it might be that you won't get the data you need.