google-analyticsgoogle-analytics-apiuniversal-analyticsanalytics.js

Replay historical data (events) in Google Analytics


Super Google Analytics Api's rockstars :)

I've lost 10 days of events in Google Analytics, but I have a log of them in my DB.

Is there a way to replay events in GA with the correct timestamp? Meaning can I send all the events to GA using their analytics.js library with a previous date?

And will they be attached to Goals (I have some goals for some events)?

Something like: ga('send', 'event', 'my Category', 'my event name', {timeStamp: new Date("06/01/2015")})

Thanks in advance !!!!


Solution

  • No. If it's just a few hours you can send data via the Measurement Protocol with the "queue time" parameter set (which allows you up to 4 hours offset to the current time; it's supposed to be used with mobile devices that might be temporarily offline), but you cannot send a timestamp.

    I suppose this is because it would force GA to constantly recalculate historical data (which is something that, at the moment, GA does only in a very limited fashion for transaction data).