Google Analytics User-ID-status showing as "Unassigned" - google-analytics

I have this scenario
I enabled User-ID feature and Session Unification feature.
On the frontend when someone Signup I set their newly created UserId and I trigger custom event, that says that someone signed up.
Then I trigger another custom event from the backend that say that user becomes a friend with someone (need to do this fro the backend) and I'm using Measurement Protocol for this hitting this endpoint when this happens https://www.google-analytics.com/collect?v=1&t=event&tid=trackingId&uid=uid&ec=eventCategory&ea=eventAction&el=eventLabel
Now the problem that I have is that I did a small test, where I registered 2 users, and for one I become a friend with someone just to see if that event triggers too
Inisde the Realtime everything works as expected, but when the reports show up the next day I got 1 user with status Unassigned
Any Ideas what can break this flow and how this can happen? I thought If data in realtime is ok that it will be on reports too, Thanks!

Miss & before ea parameter. This can make issue because event action will not recognized and it is a required parameter.
EDIT
if you have done the tests too far apart (30 minutes) you can generate some inconsistencies due to the session, considering that you send an event.
Note: real-time data is generally unreliable.

Related

GTM Consent Mode: Best way to trigger updateConsentState without full page reload?

Probably a real beginner question, as I'm trying to wrap my head around Google's architecture. I've written a custom sandbox template that is triggered by Consent Initialization - All Pages, as described in the official support document: https://developers.google.com/tag-platform/tag-manager/templates/consent-apis
Now, what I can easily do here is to set the default states and update them if the user had previously made a choice and I read out their consent from a cookie. I run the update through the callInWindow() function, which appears to be the only API function that's able to communicate with code outside of the sandbox through callback functions that I can grant access to.
Now for the following use case: The user pulls up my cookie banner and makes a different choice. If I continue using the default "Consent Initialization" trigger, then I'd be forced to make a full page reload so that the callInWindow() function runs once more in order to perform updateConsentState() with updated data from my website code.
I'd actually like to avoid the full page reload, cause that just feels somewhat clumsy from an end user perspective. Is there anything that speaks against calling my sandbox template with anything else than "Consent Initialization - all Pages"? I think I'd just create another trigger that responds to a specific button click to re-run my sandbox template and update consent through the callback function again. But nowhere in the code samples I see consent templates being used together with any other than aforementioned trigger. What I typically see is people using the dataLayer to push updates after user interaction, which Google says should not be used for consent-related settings.
Can I just go with my idea or is there anything that speaks against it?

Google Calendar API: User exists as an attendee when the meeting does not exist in his calendar

I'm using calendar API to pull events of users in an organization that had installed my GSuite app as a service account (it just means that I have access to all the users in the organization).
I noticed some weird behavior - let's say I have an event with 2 participants - a and b (both are users in the company). when I use the calendar API events.list to pull event for a I get this event, and b is listed in the attendee list with responseStatus of 'accepted'.
When I pull the events for the same period of time for user b, I do not get this meeting, nor when I try to pull a specific event using the meeting id (event.get API). I also used showDeleted=True but still didn't get the event back when pulling the events of b (I'm pretty sure if the event would have been deleted then the responseStatus would have been 'decline').
What could be the reason for this behavior? I tried to reproduce it using two emails that I have access to, and I was not successful.
Since those are emails of my client I cannot just come up to them and ask what happened with this meeting.
This is the request I'm making (using python google API client):
from googleapiclient.discovery import build as Build
service = Build("calendar", "v3", credentials=credentials, cache_discovery=False)
service.events().list(calendarId='primary', timeMin=min_time, timeMax=max_time, pageToken=page_token, singleEvents=True).execute()
First I'm building the service using the service account credentials (delegating permissions to the current email), and then making the request to pull the events.
The min_time,max_time are strings like this - 2020-10-19T08:00:00+0000.
The pageToken starts as None but will change if there is a nextPageToken in the response.
This is the request I made to try and get the meeting of the user that appear as an attendee when pulling the event using another user's email & credentials:
service.events().get(calendarId='primary', eventId=<meeting_id>).execute()
But I'm getting 404 event not found response (This API returns deleted events - I've seen it)
I'm pulling all of the events correctly, and only saw this case on small number of the events (less than 5% of the meetings).
Any idea what could cause this?
Thanks!

Authorizing the Google Calendar API in Zapier Code

I'm trying to write a Zap which will get events from a Google Calendar for the current week and generate a string describing when I'm in the office "Mon, Wed, Fri". The only thing that's stumping me is step 0. How do I auth for the Google Calendar API in a Zapier Code block? It appears that Google calendar only supports Oauth2.0 and only gives out short-lived tokens but I want this scheduled job to only run in the background and have no recourse for user-interaction. Is there any way to generate a long-lived access token?
David here, from the Zapier Platform team.
Unfortunately, that's not something that's easily doable. Part of what Zapier does for you is refresh the tokens and ensure everything is running as expected. Searching for a bunch of data (this week's events) isn't really in the zapier wheelhouse at this time.
If you're only concerned with new events, you could set up a "new event" trigger that adds the date of the event into Storage and a second zap that runs weekly, reads storage, figures out what dates are busy, and generates your string. That wouldn't hold up for recurring events though, so it may not be what you're looking for.
Alternatively, you could try and do the refresh loop in your code block, but that's really tough. You'd need somewhere to persist the token (while Storage technically works, it's open to the public so it's not a great place to store creds, even if they are hard to find). You could try your request, refresh if the token is stale, then send the eventually present value onto a later step.
Sorry I don't have better news. ​Let me know if you've got any other questions!

Google Analytics Missing Some Event Actions (Recorded in Real Time but not in Behavior)

I am using the Google Analytics Measurement Protocol to send events, there is one category and several actions. There are currently a couple dozen GA Accounts that I am sending data to (successfully) but there's one that's experiencing very bizarre behavior.
Only one action is ever being logged for this account under Behavior -> Events, but the other two (missing) actions are shown under real time. The account is using UA and the session timeout is set to 30 minutes. The first action is typically sent several minutes before the next actions.
I can verify that the requests for other actions are being sent with 200-responses. There also appears to be no filter for the missing actions or anything else that would prevent them from showing.
There is a conversion involving the missing actions and when attempting to do a verify I do get a non-zero conversion rate.
Any direction would be appreciated.
Edit: The data collection has been running for a month.

GA shows Bad Event Tracking Code message

since these days, Google Analytics start to show message "Bad Event Tracking Code" for several my projects. Even for one mobile app profile.
The message:
"The Landing Pages report has a (not set) entry. Verify that tracking code for property Mobilni Aplikace sends a _trackPageview hit and that it does this before sending any events."
I didn't change anything in these projects, so I don't understand what Google Analytics want.
Has somebody similar issue?
Thanks
Google Analytics just recently added a means of notifying you of problems so you didn't have to change anything to cause this issue. It could be preexisting.
EDIT: Solution 1 and 2 may help, but what worked was "Solution 3" -- Upgrade to Universal Analytics and increase session length.
Solution 1 - Send less tracking data
If the Google Analytics property is for a high traffic site without Google Analytics Premium you are limited to 10 million hits per month including events Data Limits - Analytics Help. In this case analytics may have recorded a user's event but the pageview was ignored to keep your account within limits.
If you could be flirting with this limit try sending less event tracking by reinventing or removing some event tracking entirely. If you are blatantly violating the data limits track only a subset of users by setting the Sample Rate in your analytics.js (or ga.js) code.
Solution 2 - Find the problematic event code
If you are not going over the data limits you have an event being sent before a pageview.
Methods of debugging "(not set) entry present in reports for property" are described on this page What the value (not set) means - Analytics Help.
Verifying this issue:
Go to the Analytics property with the issue and click Behavior reports > Site Content > Landing Pages
If you see landing page = (not set), this is generally due to a session with no page or screen view level hits included.
It’s possible to have a session that doesn’t include a page or a screen view, but does include another kind of interaction hit type, like an Events or Ecommerce hit type.
Debugging this issue:
Identify which hit type is causing the issue:
use the advanced filter (found at the top of the data table) to
restrict the data to include page/screen views matching exactly 0
For each of these 3 reports:
Behavior > Events
Acquisition > Social > Plugins
Conversions > Ecommerce reports
Note: The "page/screen views" dimension may have disappeared in advanced filters under those reports, I will update this answer when I find out more.
Solution 3 - Session is expiring before user leaves site
You can configure a visitor's session length for your property in Session Settings under Tracking Info.
The default length of time for a session or campaign. An individual session or campaign for a given user ends after the amount of time specified here has passed (counting from the start of the session or campaign), so long as the session or campaign has not been stopped though another means. Learn more about Learn more about session and campaign timeout handling.
If the user's session expires but they haven't left the page and another event triggers there will be no page view before the event has triggered. In this case your site would fall under this category:
The length of a session and campaign depends on your site and business. Here are a few ideas to get you started thinking about session and campaign timeouts:
Lengthen the session time if you have a lot of content and expect users to take a long time engaging with that content. Conversely, shorten the session time if the site has a small amount of content. 5
Increase the session length under Session Settings so these events will still have an associated pageview.
Note: You can only configure the session length if you're using Universal Analytics.
Google Analytics is currently in the process of migrating to a new operating system, the tracking code you have given in the comments appears to be the classic code. based on the information you have given in relation to your application, I believe you would be affected by phase 2 of the migration which has recently taken place
You can find a timeline of migrations along with instructions about how to upgrade your applications the the new analytics.js tracking code here:
https://developers.google.com/analytics/devguides/collection/upgrade/#phase-2

Resources