Google Analytics Measurement Protocol Not in View - google-analytics

I've integrated Measurement Protocol to add pageviews. I also have 2 views of my Google Profile for the property. The Measurement Protocol pageviews are showing up in my default view (which I call Raw Data), but the pageview are not in the alternative view which has "Exclude all hits from known bots and spiders" enabled. The only difference is the alternative view has "Exclude all hits from known bots and spiders" enabled. Would that exclude Measurement Protocol pageviews? How to resolve?

SOLVED - You need to set the ua parameter to override the default agent, which is recognized as a bot/spider and omitted from the view due to the "Exclude all hits from known bots and spiders" being enabled.

Related

GTM consent mode Google analytics not tracking pageviews without consent

we have recently implemented cookies consent mode in Google tag manager. Pageviews in google analytics (both universal and GA 4) dropped to about 4 % of the original page views.
When I visit the web page without giving any consent some requests to google-analytics.com still appears in network tab. This tells me something is still tracked. No cookies are saved as expected.
Do you have a different experience? Should GA track pageviews anonymously even without consent or it this a correct behavior? Why would analytics script send any requests if it not appears in GA?
It is expected that you see requests to Google Analytics. However in consent mode you should not see _ga cookies being set (or existing _ga cookies being used). That's basically what consent mode is, cookie-free tracking. You should also see a parameter gcs=100 in the GA request to confirm that consent mode is indeed active.
However these requests are not surfaced in the reports (there would be no point, since without user identifier you cannot create sessions). Apparently they are being used for some sort of Machine Learning thing in the background, but I don't think this has much effect on the analytics part of GA (afaik this is more for Google Ads and GA audiences).
So yes, seeing requests in consent mode is normal (if this helps in any way with GDPR compliance etc. in entirely another matter). If you do not run campaigns and do not hope for an uplift via ML models applied to consent mode data, then you probably do not need to bother and can just disable the tags if no consent is given.
It happens because you have to set ad_storage and analytics_storage as denied by default in initialization code, like described in the documentation (in the example only ad_storage is denied, just add analytics_storage too): https://developers.google.com/tag-platform/devguides/consent#implementation_example

How to set User Agent in Measurement Protocol (Google Analytics 4)

How to set or override User Agent value in Measurement Protocol (Google Analytics 4)?
It was easy with previous Measurement Protocol (Universal Analytics): https://developers.google.com/analytics/devguides/collection/protocol/v1/parameters?hl=en#ua
But it is not clear to me how to send User Agent to Google Analytics v4.
If you check the documentation at the top of the page Measurement Protocol (Google Analytics 4)
You will see that this protocol is still in alpha and is extremely limited there is a lot we cant do with it.
As of the time of posting this answer the answer is you cant. I suggest you wait a while as time goes on the team will begin to add new features.

Google analytics - allowed hosts

I'm seeing entries in my analytics data for pages that no longer exist.
This could be developers looking at legacy versions of a site, it could also be triggered by something like wayback machine.
Is there a way to either identify what hosts an analytics tracking pixel is being triggered on, or restrict analytics to only execute on either a set of domains/hosts or ip address
LinkedIn campaign manager and Hubspot have features where you can tell the tracking script what domains to include/exclude
This is different from excluding ip addresses when setting up filters
Thanks
you can use filters on view level (Universal Analytics, not GA4) in order to exclude or include specified domains to ga data. Keep in mind, adding or removing filters work for new collected data only. Maybe add an additional view, so one view contains all data (based on your ga setup). With this solution GA collects data but will not show the data in the filtered view.
In order to fire the ga tag on a specified domain, specify the host in the trigger in Google Tag Manager, if it is implemented on page. This setting the tag will not be fired on other domains.
If there is no Tag Management on the page, you can check the domain using js before firing the ga script.
Keep in mind, that it is possible to send data to GA without fireing the GA tag by using Measurement Protocol. So if a lot of spam data appears in the interface, may add additional filters to exclude this data aswell.

How to remove '(not set)' false positives in Google Analytics traffic reports about DSpace

Google Analytics traffic reports for eCommons on DSpace have recently massively spiked false '(not set)' hits, so we're getting impossibly high hit numbers on web traffic. We can filter them out in the GA reports, but is there a way to configure something in eCommons, DSpace or GA to not register them in GA in the first place?
I believe this would be a good use of the filters, located under the View settings. I use these filters for ghost spam on all my properties, and you should be able to use them for your case.
It's not clear what field is showing up as (not set) in your case, but assuming it's one of the available filter fields in the drop down, you can build a filter that excludes all hits with a specific value.

What type of Google Analytics Property for Measurement Protocol?

When setting up Google Analytics Measurement Protocol what type of Google Analytics Property should I create?
There does not seem to be a "Universal Analytics" or "Measurement Protocol" option, which is the source of my confusion and the reason for my question.
The two choices are Web Site and Mobile Application, and both seem to need configuration beyond what is suggested as the requirements in the Measurement Protocol page.
The Measurement Protocol is property-agnostic. If you go to this hit-builder site, https://ga-dev-tools.appspot.com/hit-builder/, you will notice that it doesn't ask what type of property you are using (ie. UA vs classic GA). It just needs to know the property ID, type of hit, client ID, and version number.

Resources