Use measurement protocol to create transaction/item for a specific date - google-analytics

I am using the following URL to generate an item for the transaction.
http://www.google-analytics.com/collect?v=1&tid=someID&cid=someID&ti=126540&ta=Another%20type&tr=400.00&tt=0&ea=Purchase&pa=purchase&ec=Enhanced%20Ecommerce&ts=0&cu=UAH&t=event&pr1id=cha803478-WTC%2FNBK&pr1nm=foo%202PP%20crew%20socks&pr1ca=foo&pr1pr=199.00&pr1br=foo&pr1qt=1
After a few days I will need to change it, because any data in it will be not correct. Is there a way to specify date on this URL so that the modification of the transaction was the day it was created?

No. While there is the queue time parameter that allows for a few hours offset there is not way to specify a date in a hit (that would force Google to reprocess a lot of data to integrate hits for previous dates in the reports).

Related

GA report API v4, I want to update data every minute. How to update data if there is no identifier?

I have some criteria for the report and I want to add them to postresql and update for example every minute.Should i have to call reporting api for the current day and overwrite all the data for the current day?
calling reporting API every second for today's data has a little sense since Analytics data processing lag is 24-48 hours and most probably your data won't be updated with 1-sec frequency.
Also, the only convenient way to export data to own storage from API is scheduled calling reporting API for a dynamically generated date range (like last seven days) and overwriting the existing data in the storage.
You might add ga:date to your reported dimensions to get your report data date-wise so you'll be able to track what needs to be updated.

Firebase BigQuery server offset time

Background:
I'm having the Firebase analytics data exported to BigQuery. And I'm using cron jobs to crunch data in BigQuery for getting insight.
Problem:
To be able to only crunch delta data i.e. the data that has arrived since last time I ran my cron job I need a way to figure out the time when the data arrived at server, since the event_timestamp is generated at client and can be cached at client before sent.
Insights:
I have laborated with event_server_timestamp_offset (offset) which I thought I could use together with event_timestamp. But I was expecting the offset to only be positive but it can also be negative. And when I look at the MAX and MIN for the offset in the entire exported Firebase analytics dataset and re-calculate it to years instead of microseconds I can get more than 18 years offset.
Query:
SELECT
MAX(event_server_timestamp_offset)/(1000000*60*60*24) max_days,
MIN(event_server_timestamp_offset)/(1000000*60*60*24) min_days
FROM
`analytics_<project_id>.events_*`
Result: max_days=6784.485790436655,
min_days=-106.95833052104166
Question:
How can I figure out the server arrival time for my Firebase exported BigQuery data so I can run cron jobs crunching only delta data?
Can I use event_server_timestamp_offset together with event_timestamp? If so, how?
Best regards,
Daniel
Surprisingly enough, this question not having a clear answer for almost 2 years, I am leaving here the answers I got from the Firebase support team. The format is - question asked followed by the answer of the support staff.
Q1. event_date - The date on which the event was logged (YYYYMMDD format in the registered timezone of your app). Does it mean that the event occurred on that date, or that it was actually collected on that date?
A1. Per documentation, event_date refers to the date on which the event is logged/occurred. Note that event_date is based on the Analytics timezone setting of your Firebase Project.
Q2. event_timestamp - The time (in microseconds, UTC) at which the event was logged on the client. Is it safe to assume that this is the exact timestamp the event occurred on client side (in the app timezone of course)?
A2. Yes, this is based on the device timezone setting. However, event_timestamp may be skewed if the device time is incorrect.
Q3. event_server_timestamp_offset - Timestamp offset between collection time and upload time in micros. This is the main field that causes all the misunderstandings - in our BigQuery table for the year 2020 this field takes values in a range between 5 days and -2 days. I mean how can the colleciton time be 2 days ahead?
A3. The event_server_timestamp_offset field in the export schema is the time difference between when the event took place and the app uploaded it to our server. In other words, this is the estimated difference between the client's local time and the actual time, according to our servers. The values of this field are usually positive, but can be negative as well if the device time setting is incorrect.
Q4. One last question is very important - can we ignore the
event_server_timestamp_offset field and just rely on event_timestamp -
as the exact date and time the event occurred on the clientside (not
collected, not uplaoded, etc). If not- please explain how we can get
the exact datetime of the event occuring on the clientside. But if yes
please let me know why do we need the event_server_timestamp_offset field?
A4. Yes, you may actually ignore it and use event_timestamp alone. However, as mentioned earlier, event_timestamp could be off if the device time setting incorrect, but it shouldn't really affect the bigger picture of your analytics data as cases like this are usually one-off.
We use the event_date as the indicator and load the data once a day.

IFTTT - record timestamp (rather than time range) in Google Calendar

I created an IFTTT recipe that logs the time I arrive and leave work every day, but it always records it in 1hr blocks.
I'm using iPhone's location to track when I arrive and leave. Everything seems to be working, but calendar events are showing as 1hr blocks rather than just a timestamp.
For example, if I arrive at 8:05am it will show as a block on my calendar from 8:05 to 9:05 rather than just showing for one minute. I'd rather it just say "I arrived at work at 8:05". Thanks in advance!
Am I right in assuming you used the default "Track your work hours in Google Calendar" applet made by Google ?
It uses the Quick add event action to add this event to your calendar. Instead, create your own version of the applet that uses the Create a detailed event action. This allows you to set the following parameters (specifically, it includes Start time and End time):
You can set the start time and end time to the same value, but it will, of course, still read as an event that runs from e.g. 9:05 to 9:05.
If you want to record just a single timestamp, you will need to use a different service to store your data. Perhaps record the data in a Google spreadsheet ?
Any queries, post a comment and I'll get back to you.

How to change the value of a conversion in google analytics

i have a question on e-commerce tracking. As i know in a latter stage that a conversion is successful or not i want to be able to convert a sale as conversion but with 0 value and then when the sale is actually converted to change the value of revenue for this specific sale. Is somebody able to help on that?
Best regards and happy weekend to all.
As far as I can tell this does not really work.
If you do E-Commerce tracking you can send a second transaction using the same transaction id, and at a first glance this will look like it changed to original value; however internally this will still be recorded as two transactions and change some of your metrics (e.g. conversion rates). Also the second transaction will not be connected to the original session and will most likely be attributed to a different marketing channel. Still, this is the closest you will get to change the transaction value (and you won't be able to change goal conversion values at all).
While GA has data imports it does not have a transaction data import, and at least the free version cannot change data that is already collected (data imports only apply to newly incoming data), so this will not help you.
All in all it would be simpler/more reliable to pull the data via the API and connect it to your revenue data in a spreadsheet.

Google analytics date format

I would like to obtain data via the Google analytics api (Java). Every half an hour once I would be running a script which needs to get me the required variables over the previous half an hour, that is details of the person who has used my site over the last half hour. I do not know if this is possible since the start date and end date parameters can be used only in date format and not in datetime format. How should I proceed with this? Thanks in advance
Google Analytics core reporting API provides 2 dimensions which are the hour and the minute. This should allow you to accomplish what you want, just make sure to wait till the hour and minute you are querying are updated.
Check
https://developers.google.com/analytics/devguides/reporting/core/dimsmets#view=detail&group=time&jump=ga_hour

Resources