reporting api v4 unique events metric issue - google-analytics-api

I just want to ask you about the Reporting API v4 because I'm seeing different values between API response and web reporting view (Google Analytics dashboard). The metric is unique events.
This is the query using API Explorer
API Explorer query screenshot
And here is the API Explorer result (if you want to see the query, read my first comment below, please notice green and red highlighted)
API Explorer result screenshot
On the other hand I'm using the web report viewer and for unique events I'm always seeing different values (also I used many other filters, with different scenarios, always returning different data in unique events metric), but (the weird thing) is total events value is ok (in all cases). I used the same dates for API and web view calls (also I applied same filters on web reporting, also I tested using other metrics and the values are the same, so there is no layer 8 issue)
Web reporting screenshot
Do you know what's going on here? I don't know which value is correct, I don't know if API or web reporting is failing.
Best.-

Please check this changelog entry - https://developers.google.com/analytics/devguides/changelog#event_tracking and this support article - https://support.google.com/analytics/answer/7084499?hl=en
It's all connected to the changes in unique events-connected metrics from September '16 (you can read more about it on Analytics Blog under "Improving Google Analytics Events with Unique Events" post).
Right now:
WEB UI "Unique Events" = API "ga:uniqueEventsTemporary";
WEB UI "Unique Dimension Combinations" = API
"ga:uniqueDimensionCombinations" and "ga:uniqueEvents".

This is the query using API Explorer (I posted in an answer because I couldn't do in question, only 2 links allowed)
API Explorer query screenshot

Related

Different Values Between API and Web Google Analytics

I am trying to automate the extraction of information from google analytics. I compare the result of the api and the web they are different. Although I'm applying the same filters in the web panel and the api.
I think the filters are correct because I get the same campaigns as a result, but with different values.
If someone can help me or explain the problem, I would appreciate it.
Result Query Explorer
Result analytic dashboard

REST API testing common issues

I have recently started testing rest based web services. I am wondering what are common issues faced while testing them.
I generally look for
response status (http code is among 200/400/500)
response headers (cache control, response type, content length )
if expected fields / values are present in json response.
I want to know what else to look for and issues in general while testing rest based web services
This is actually a very broad question but, here are the things that I look for while testing rest API's:
Response codes, Response headers
Check if Authentication/Authorization is correct based on user privileges
Check to see if the supplied value can break the output
Intentionally pass different Data-Type values to see if proper handling is done or not
Use load testing tools to see how many concurrent requests an API can handle
Again these are just a few things that will depend on the type of API you are building. Feel free to add more as you progress.
There are many, but let me share a few that aren't even specifically API issues but a full API integration test will help find it.
We did an integration API test where a publisher's product listing endpoint was hit, and then we randomly picked 100 of those products. Every few weeks we would find a bunch of bad product ID's. How was it possible? They would update the database but the product listing endpoint was cached and had bad information for hours until it was refreshed automatically.
Another time we found an e-commerce company in Brooklyn that, on average, had 3,500 products out of their 50k+ were missing a category. This meant 3,500 products not showing up if you browsed by categories, and potential lost sales.
We have a whole case study of this stuff on our website. Weird and unexpected stuff happens all the time. Test for everything and catch as much as you can. Every object in the payload should be verified, it may seem like overkill but there are platforms that can do all that work for you.
Here are suggestions based on my experience while testing Restful APIs.
Make sure that you are validating proprietary headers if you are using with your APIs.
Confirm that you are including correct location header in the response so that Rest API caller can use that for verification or for subsequent calls.
Check that location header protocol is correct i.e as per your design. (http/https). It's very important for subsequent calls.

Metadata API for Google MCF Reporting API

If there a similar meta data API for MCF reporting like there is for GA:
https://www.googleapis.com/analytics/v3/metadata/ga/columns?pp=1"
No currently the Google Analytics Metadata api only supports the Normal Core reporting dimensions and metrics.
But if you check the documentation for columns list there is a parameter option. It currently states.
reportType string Report type. Allowed Values: ga. Where ga
corresponds to the Core Reporting API.
Right now the only thing you can request are the ga dimensions and metrics but this implies to me that they may at some point open up for more.
I added a feature request a while back asking for Access to Realtime Dimensions and metric list. I have asked the devs and the only response was they weren't going to do it right now.

Spotify Metadata API : Limit search results

Is there any way to limit the number of records returned in the search artist endpoint of Spotify's metadata api?
Currently, it seems the default is one hundred, and we're only really interested in the first record.
This has been answered previously; Spotify Web Apps - limit results to 50 instead of the default 100. To my knowledge, this has not changed and you are unfortunately still given page with up to 100 results.
However, I'd strongly recommend that you stay tuned for news regarding the Web API in the near future.
Edit: We've launched a new version of the Web API, allowing for limiting search results.
Example: https://api.spotify.com/v1/search?q=elvis&type=artist&limit=1
Please check out the official documentation for more information.

Why is custom variable data in the Google Analytics Data Export API data different from my Google Analytics dashboard?

I have a custom variable defined on my site and the data is being recorded properly in my Google Analytics account. When I go to access the data via the Google Data Feed Query Explorer, the data I get isn't the same. Really, this is only the case with 'Visits' and any metrics calculated using it.
This is what I see in my dashboard:
http://www.screencast.com/t/QJl21ZOmpw
This is what I see in the query explorer:
http://www.screencast.com/t/WNGLiUUWum
I made sure the time frame matches and have pulled the same metrics. 'Hits' (aka pageviews) match up perfectly every time. Visits is obviously off and seems to be messing up other metrics that depend on it, such as 'Pages/Visit' (aka pageviews per visit).
I have reviewed the code and the custom variable is being set prior to recording the pageview. Am I missing something? My understanding is that Google Uses this exact same API to run their Analytics Dashboard, so why am I getting different data?
Try removing the visitors metric from your feed in the Query Explorer. A "Visitor" is different than a "Visit". I believe the stats of the Google Analytics screenshot have nothing to do with visitors. And including this metric might actually limit your result set to the unique visitors (I think).