Adding ga:adMatchedQuery breaks API request - google-analytics

I have a script that imports data from Google Analytics to my BI. It was working for years. Recently it stopped working.
After investigation, it turns out that removing ga:adMatchedQuery from dimensions solves the issue.
I checked changelogs (https://developers.google.com/analytics/devguides/reporting/core/v4/changelog?hl=en, https://developers.google.com/analytics/devguides/reporting/changelog?hl=en, etc.), and do not see any deprecation notices. Are there?
Nevertheless, are there any alternative way of getting visitor's search term for my adds in Google API?
Update:
Further investigation showed that I can make a request if adMatchedQuery is the only dimension. Adding the second dimension (for example, my custom dimention or ga:hour) breaks the request.
For example:
https://ga-dev-tools.appspot.com/query-explorer/?start-date=2022-09-01&end-date=2022-09-08&metrics=ga%3AgoalCompletionsAll&dimensions=ga%3Asource%2Cga%3Amedium%2Cga%3AadKeywordMatchType%2Cga%3AadMatchedQuery%2Cga%3Acountry%2Cga%3Adate%2Cga%3Ahour&sort=-ga%3AgoalCompletionsAll%2C-ga%3Adate&ids=ANALYTICS_ID produces empty set.
https://ga-dev-tools.appspot.com/query-explorer/?start-date=2022-09-01&end-date=2022-09-08&metrics=ga%3AgoalCompletionsAll&dimensions=ga%3Asource%2Cga%3Amedium%2Cga%3AadKeywordMatchType%2Cga%3AadMatchedQuery%2Cga%3Acountry%2Cga%3Adate%2C&sort=-ga%3AgoalCompletionsAll%2C-ga%3Adate&ids=ANALYTICS_ID gives me results.
The only difference is that I removed ga:hour from the list of dimensions in the second link.

Same here, it seems google made an update on Sept. 1 to restrict search queries that don't meet their higher privacy threshold, however it seems like they completely shut off search query reporting in GA. Hopefully they recognize this bug and fix it.
Check https://support.google.com/analytics/thread/178348751/search-console-report-not-showing-search-queries-for-landing-pages?hl=en&authuser=1

I had the same issue and here is my solution.
Since Universal Analytics will no longer process new data in standard properties beginning July 1, 2023, Google is asking us to switch over to a Google Analytics 4 property. I guessed that it should be a way to keep us updated. So I updated my property for GA4 and I manage to access that dimension.
The ga:adMatchedQuery now could be found at GA4 as firstUserGoogleAdsQuery,sessionGoogleAdsAdNetworkType or googleAdsQuery.
I also found out that the API changed.
The service in the Google Cloud that used to bring the data was "Google Analytics Reporting API" now you need to use the service "Google Analytics Data API"
That is the quickstart Guide:
https://developers.google.com/analytics...
Metrics and Dimensions:
https://ga-dev-tools.web.app/ga4/dime...
I'm coding in Python, and that video helped me a lot:
https://www.youtube.com/watch?v...

We had the same issue since 5 September.
I found a solution on github. They say you have to replace the ga:adMatchedQuery with ga:keyword.
This works for me, but not entirely sure if it is the same as adMatchedQuery, but the results look good though.
Hope this helps you too.

Related

where to find google analytics dimensions values

I'm trying to implement my own google analytics reporting UI where users pick metrics and dimensions and then pick the filters according to what the user have already chosen and my question is there any way to get all the dimensions values? for example the dimension "country" can take the value of all the countries(USA,Fance,etc...). I've did some research on google but found nothing. any help is appreciated!
I would suggest using something like Analytics Edge extension for Excel to do exactly what you're trying to do.
If that doesn't completely solve what you're doing, the extension does pull all the pullable fields from GA. It also gives you an insight into what kind of request it sends to G to pull the data. Very useful for debugging, but also for learning the reporting API.
Alternatively, there's documentation on the API here: https://developers.google.com/analytics/devguides/reporting/core/v4
Make sure you know whether you're using GA4 or GA UA. They have different APIs.

The Dimensions on comparison of Google Analytics APP+WEB property is disabled

Last Thursday, most dimensions on comparison function of Google Analytics APP+WEB property is disabled. So we can't use comparison function.
I think it's some kind of api bug, if someone knows about this please let me know when it will be able.
error message shows 'No data currently available for this dimenstion'
Check if the Google Analytics data source contains data for the specific combination of dimensions and measures.
I think Google has done hotfix yesterday. So Today We can use whole dimension in comparison.

How to correctly deal with duplicate transactions in Google Analytics?

Accidentally someone send 455 duplicate transactions to Google Analytics and i would like to fix it so my question is how?
I know of 2 methods:
Refund -> Im not exactly sure of the consequences this have on the reports
Send transaction with negative value -> I dont think this works as i expect since all it will do is add a new transaction with negative value but i ll be seeing 3 (1 original, 1 duplicate and 1 negative).
We are using Enhanced Ecommerce.
I strongly believe that Google analytics is able to deduplicate identical transactions that were recorded in the same session (but I can't seem to find a resource that supports this). There are other methods you could deploy to add preventative measures like the ones in these resources:
https://www.thyngster.com/preventing-duplicate-transactions-in-universal-analytics-with-google-tag-manager/
https://productforums.google.com/forum/#!topic/tag-manager/pnmWOvHVk8s;context-place=forum/tag-manager
I finally solved using this docs: https://support.google.com/analytics/answer/1037443?hl=en
Since im on the same day this worked perfectly.

Mixable metrics and dimensions in google analytics

I'm doing some complex reports for google analytics and would like to ask you if the following is possible. The client wants to have just organic data for a bunch of metrics. Like pageviews, visitBounceRoutes, etc. The query I ended up with is the following:
https://www.googleapis.com/analytics/v3/data/ga?dimensions=ga:source,ga:medium,ga:keyword,ga:day,ga:month,ga:year&end-date=2013-11-20&fields=columnHeaders/name,rows,totalResults,totalsForAllResults&filters=ga:medium==organic&ids=ga:79067749&metrics=ga:pageviews,ga:pageviewsPerVisit,ga:visitors,ga:avgTimeOnSite,ga:newVisits,ga:visitBounceRate&start-date=2013-10-20
However the response is as follows:
'{"totalResults":0,"columnHeaders":[{"name":"ga:source"},{"name":"ga:medium"},{"name":"ga:keyword"},{"name":"ga:day"},{"name":"ga:month"},{"name":"ga:year"},{"name":"ga:pageviews"},{"name":"ga:pageviewsPerVisit"},{"name":"ga:visitors"},{"name":"ga:avgTimeOnSite"},{"name":"ga:newVisits"},{"name":"ga:visitBounceRate"}],"totalsForAllResults":{"ga:pageviews":"0","ga:pageviewsPerVisit":"0.0","ga:visitors":"0","ga:avgTimeOnSite":"0.0","ga:newVisits":"0","ga:visitBounceRate":"0.0"}}'
Can the dimensions ga:source,ga:medium,ga:keyword be mixed with the above metrics? It seems they can't since if I omit them the API returns an array of values 1 per each day within the specified range.
Where can I find more information about this and what categories are mixable? https://developers.google.com/analytics/devguides/reporting/core/dimsmets just shows all the available metrics but do not explains how they are combined and which one would be valid requests. I'm new at the analytics API and would be great any kind of help or guidance
Thanks a lot
Google Analytics Query Explorer is your friend for playing around with analytics dimensions/metrics/filters ;-)
Try http://ga-dev-tools.appspot.com/explorer/?dimensions=ga:source,ga:medium,ga:keyword,ga:day,ga:month,ga:year&metrics=ga:pageviews,ga:pageviewsPerVisit,ga:visitors,ga:avgTimeOnSite,ga:newVisits,ga:visitBounceRate&filters=ga:medium%253D%253Dorganic&start-date=2013-10-20&end-date=2013-11-20&max-results=100
Some thoughts:
Those dimensions & metrics should work -- maybe there was no organic data recorded during that time range?
Try removing the ga:medium==organic filter and see what your data looks like.
Does the profile you're using (ga:79067749) have any filters on it? If so, maybe try a different profile that has unfiltered data. (Analytics best practices -- make sure you have a profile with no filters applied that captures all data.)
As Mike said, there is no problem with the combination of metrics and dimensions you are using.
If you are entering the URL query directly in the browser problem might be the lack of URL encoding in your query string. For example, you need to convert == to %253D%253D
For example, instead of ga:medium==organic, you need ga:medium%253D%253Dorganic
If you build your query in the Google Analytics Query Explorer as Mike suggests, you can grab the direct link to your report by clicking the link symbol in the upper left:

Google Analytics - Custom Alerts for Real-Time data

I'm looking to create a custom alert to notify me whenever X number of people are on the site at once. This data is already available using the Real-Time reports page. However, this does not seem possible via the Intelligence Events section. From there, I'm only able to create custom alerts based off Day, Week, or Month data. Has anybody found another area of Google Analytics that would make this type of report possible?
Google Analytics have just launched a Beta of their Real Time API which might let you do this: http://techcrunch.com/2013/08/01/google-launches-real-time-api-for-analytics-in-invite-only-beta/
You can use the real-time API for that. It's been possible for quite a few years now. You can find all the documentation for that right here. It's typical OAuth + JSON API.
You can also use a paid service. I built one, Metrics Watch. It really depends of your goal and how critical this is to your business/job. If it's critical, I would highly encourage you to look for a paid service, no matter which one.
Hope that helps!

Resources