I have a variable that's being laoded on my page and then being reported back to GA via the event tracking api. Is there a way for this "event" to be associated with the flow of an individual session?
For example: If I have a variable that gets reported as "eligible", can I then associate this event with the session and page flows?
Yes, you can create an advanced segment. That is a way to filter sessions (visits) according to certain criteria. In this case, your criterion would be "Include: Event Label = 'the name of the label of your event'".
Note that it is against the terms of use of GA though to report data on an indidivual basis, i.e. it is not allowed to create an event label that allows you to identify each single session.
Related
I am currently listing all events from a Google Calendar using the "singleEvents" parameter set to true, which splits recurring events into individual events – which is good. However, I'm running into an issue when an instance of a recurring event is edited, and the edits are saved with the "Only this event" option in the Calendar UI.
What I need to do is be able to identify which of these recurring event instances have been edited, and which have not. It seems the API response data does not provide any indications of whether this is an instance of the unedited recurring event, or an edited one-off. The response for an unedited instance of a recurring event and an edited instance are more-or-less the same, save the description field, which was edited.
The reason I need to differentiate edited versus unedited recurring event instances is that I am dynamically creating event detail pages from the list of single events. I would like to have one page be for the recurring event itself, and another for a "one-off" of that recurring event. E.g:
allmyevents.com/events/my-recurring-event --> page showing recurring event with recurrence information
allmyevents.com/events/my-recurring-event/16-4-2020 --> page showing specific instance of recurring event, which has been edited
Currently, I'm able to do this by creating an entirely new event at the same date and with the same title as the recurring event instance I want to replace, and writing hacky comparison logic to tell if this is a replacement event, but this is counter-intuitive for event/content management.
Answer:
You can use the Calendar API Events: instances endpoint to return all instances of a recurring event. All the events which have been edited on their own will not be returned.
More Information:
The Events: instances endpoint of the Calendar API will return all instances of a recurring event for a calendarId and eventId specified. Any of these that have been edited are omitted.
It's a bit of a workaround, as these events can't be obtained directly, but by obtaining the list of events as you have already been doing and then removing the events which are returned by Events: instances, you can build a list of all the events which have been edited with the 'Only this event' option.
Psuedo-code:
You can do something like this:
eventsList = Calendar.Events.List(calendarId, singleEvents=true)
eventsInstances = Calendar.Events.Instances(calendarId, recurringEventId)
singleEvents = eventsList
for each instance in eventsInstances :
if eventsList.items contains instance :
singleEvents.remove(instance)
return singleEvents
Where the returned singleEvents variable will be a list of all the events that have been edited manually.
References:
Events: instances | Calendar API | Google Developers
Recurring Events | Calendar API | Google Developers
I've been puzzling through this same issue, and I think I've found a way forward that doesn't involve going through every single instance to check if they've been moved/edited:
Each event returned by the Calendar API has an iCalUID field. For a standalone event, this should match the event's id, with an #google.com suffix. e.g. an event with the id of abcdef has an iCalUID of abcdef#google.com.
When it comes to recurring series, every single instance of that event has the same iCalUID value - and, most importantly, you can use iCalUID as a filter when listing events, which will return the main recurring series event and all modified instances. Unmodified instances are not returned.
Tracking which instances have been deleted is slightly more fiddly. They might be returned in the list with the matching iCalUID, but with a status set to cancelled. Or, they may be specified within the recurrence property (an array of strings) on the main series event as timestamps (within the given time-zone, which should match whichever time-zone the main series event uses):
[
"RRULE:FREQ=WEEKLY,COUNT=5",
"EXDATE;TZID=Australia/Melbourne:20211227T110000,20220103T110000"
]
I haven't figured out why some recurring events use the specific-instances-as-cancelled approach, and others use the EXDATE approach (and I think they can also be combined, so don't presume the presence of one rules out the other). Given both are possible, you'll have to allow for that.
If I apply a session-based custom segment defined as user-id status matches exactly "Unassigned" in the standard user-id view the segment is matched by several sessions / users.
Since the user id view should only encompass sessions where the user id is set this shouldn't be the case.
I can't find any proper documentation on how the built-in dimension user-id status gets populated, but I would assume that it is derived from the uid parameter sent with the server calls.
How can the value of dimension user-id status ever be "Unassigned" within the user id view?
Taking the reversed segment defined as status=Assigned there are users that never had a userid assigned to them and are still in the user-id view.
How can user without an assigned userid be part of the user-id view?
Side note:
Implemented via GTM
Session Unification is active
user-id status is a Google-intern dimension automatically created when setting up the userid feature.
Unassigned is not a value GA would set (when a value is not defined in GA it is set to (not set)), **so if it's there it's because someone set it.*
Now with regards to your segment, the question you are asking GA is:
give me users who during ANY session had status=Unassigned
this includes sessions prior to identification because Session Unification is active
So anybody who had status=Unassigned at some point and then identified will match that segment.
If you want to know users who have status=Unassigned as their latest status you want to make sure your custom dimension is set to User Scope and that you replace Sessions Include with Users Include in your filter.
What would be the easiest way to get a report on Google Analytics containing authenticated users ordered by the last login time (the latest login first)?
We are already using Event logging with Category "User", Action "Login" and Label set to user ID (a GUID). Is it possible to base the report on this data?
UPDATE 5-Dec-2018:
As a reference, we have a Custom Report for top logins:
This shows:
Now, I would like to change 'Hits' to "the last time the event occurred", with the given Event Label.
You can create a custom report with the event label ordered by date and time. Though the default implementation in GA only gives you up to the hours I believe. If you want more granularity, I think you'd need to create a custom dimension with a timestamp to the second/millisecond and capture that data front-end.
With the previous version of Tag Manager (dataLayer), it was easy to fetch variables sent within previous events, when those variables weren't sent with the current.
How to persist parameters with the Firebase version of GTM?
For example, previously, I could send an event with a user_id variable at the start of the session or as soon as the user logs in. I would then create a "Data Layer Variable" in GTM and use it to get this user_id at any subsequent point in the session. For instance, to send it as a GA custom dimension on a purchase event possibly made later.
Now, if I push a Firebase event with a custom parameter user_id and then create an "Event Parameter" variable in GTM, it will only be available within this event.
Same if I send a user property with Firebase and register a "Firebase User Property" variable in GTM. I won't be able to use this variable within an event at a later point in the session
Is there a way to persist user properties and event parameters?
Unfortunately, we all miss the data layer like approach.
I got a confirmation that the only way to "persist" data between events using Firebase SDK is to use user properties, which function like "sticky" events within Firebase. Otherwise, the parameter would need to be sent anew with a future event.
Combined with a limitation of only sending string and numbers but not dictionaries makes this a bit less convenient.
Can I use client ID as a dimension in my reports? Client ID does not appear as a dimension in the Dimensions and Metrics Explorer, but I believe I can create a custom dimension that will store the Client ID. My end goal is to have a row per customer/date+time containing the incidents associated with the particular customer at the particular time, e.g. page visits, particular events etc
Once you've created the custom dimension in GA, you can start tracking it via analytics.js with the following code:
ga(function(tracker) {
// Assumes dimension is at index 1.
tracker.set('dimension1', tracker.get('clientId'));
});
I found that the google analytics will NOT save your custom dimension if it matches the value of "client id" (even if that id isn't actually PII). However, if you alter the "client id" to become a different value, it will save properly.
Here are the guidelines about what you are allowed to send