Discrepancies in the "totalsForAllResults" field for "ga:users" - google-analytics

If I make a request to the Google Analytics API using only the metric "ga:users", the result is different to the one that is returned in the "totalsForAllResult" field when I add a dimension.
Does anyone know the explanation for this and which is the correct result?

You cannot sum up the user counts per dimension and get a gross total as one and the same user can appear in multiple dimension values. For a detailed explanation look here. If you want to get the total users value, repeat the API request w/o the dimension. Apparently, Google does the mistake of blindly summing the values themselves in the totalsForAllResults field of the response of the Core Reporting API which can be highly misleading.

Related

Using LinkedIn API to retrieve advertising reports

I'm working on a simple app to programmatically retrieve ads performance within Linkedin. I have general API experience but this is the first time i get my feet wet with the Linkedin API.
One example from Linkedin API documentation suggest something that would get me started:
GET https://api.linkedin.com/v2/adAnalyticsV2?q=analytics&dateRange.start.month=1&dateRange.start.day=1&dateRange.start.year=2016&timeGranularity=MONTHLY&pivot=CREATIVE&campaigns=urn:li:sponsoredCampaign:112466001
I am encountering two problems:
First this example implies that you already know the campaign ID. However I am unable to find a way to retrieve a list of campaign ID's for a given account.
Second, if I manually pull a campaign ID, I receive an error: "{"serviceErrorCode":2,"message":"Too many fields requested. Maximum possible fields to request: 20","status":400}". Pretty clear error.
A little research tells me that by adding the parameter "&fields=" I will be able to limit my query to less than 20 field (I really need only a dozen anyway) but I can't find and documentation regarding the names of the fields available.
Any help or pointer will be appreciated.
please refer the link below scroll down where you ill see the field names mentioned as metrics , these are the fields.
https://learn.microsoft.com/en-us/linkedin/marketing/integrations/ads-reporting/ads-reporting?tabs=http#analytics-finder

Can I combine device category with hit-level metrics in Google Analytics?

I'm querying the Google Analytics API, and got a question about combining different dimension and metric scopes. Is it possible to combine a user-level dimension like "Device Category" with a hit-level metric, i.e. "Unique Pageviews"?
I know I can't combine hit-level dimensions like "Page" with session-level metrics like "Sessions". But I can't seem to find any documentation of other combinations.
My gut tells me it should be possible as user-level dimensions are stored in a cookie and then be associated with each hit. But I'd really like to get a second opinion on this.
You can identify valid combinations of dimensions and metrics with Dimensions & Metrics Explorer tool:
https://ga-dev-tools.appspot.com/dimensions-metrics-explorer/
Since not all dimensions and metrics can be queried together, with this tool you can select a dimension or metric checkbox to see all the other values that can be combined in the same query.
[EDIT]
If your request is which dimensions and metrics may be misleading when combining, the answer is... depends on the result you want to obtain and on knowing how to recognize the data. If you want to know which pages are most viewed when a user lands in a specific landing page, you can do this by querying landing pages dimension and page dimension. You will have repeated the landing page many times in the reports (many times how many pages have been viewed from sessions originating in that landing) but this does not mean that it is wrong. Sure depending on what you combine you can get a misleading result, but Google Analytics cannot know if it is misleading for you or if you wanted to do it.

Google Analytics Reporting API - ga:mobileDeviceInfo dimension

I am trying to obtain session data from the Google Analytics API (v3), however am getting some very strange results.
If I use the ga:sessions measure and ga:dateHourMinute dimension; I am able to obtain correct results.
However - if I add ga:mobileDeviceInfo as another dimension to the query, I receive a reduced dataset (based upon total of ga:sessions)
Is anyone able to assist?
It appears that non-mobile devices (rather than populating ga:mobileDeviceInfo as null) will be excluded from the results when including this dimension. This does not appear in the documentation.

how many values can a custom dimension take in google analytics?

To anonymously analyze users flow and engagement I want to use the ClientID, as identifier of each user, as a value of a custom dimension. I have two questions regarding this idea:
How many values can be associated to a custom dimension? This will determine the feasibility of this approach or not.
Is there any other approach to track individually, yet anonymously, users activity?
I'm not aware of a limit though for custom dimension length. But storing userId, sessionId customerId and timestamps for all hits in custom dimensions is not all that unusual these days. Here is a link to a post by Simo Ahava's post Improve Data Collection With Four Custom Dimensions on how to set it all up in google tag manager.
For hit based custom dimension you can store as many values as there are hits. The problem is not storage, the problem is that the interface will not show more than 50 000 rows with distinct values (any additional value will go into a row labeled "other"). Also some of the reports (namely demographics) will not work with very small segments.
I cannot think of any other way to track users individually (and if you are interested in opinions, I blogged about how I do not understand why people want to do this). The interface is not very well suited for this kind of "atomic" information, so I think the approach is more useful for API integrations that can properly visualize information on a per user basis.

Google Analytics: Using custom variables to track growing values

I believe custom variables in Google Analytics can only be used to track the distribution of different values for that variable over time.
Suppose I have a forum and want to track the total number of posts made in that forum. Could I track them over time with Google Analytics, too? And how?
Custom Variables are a user-based dimension. So, traditionally, instead of measuring forum posts, they'd instead identify users who post on forums. That doesn't seem like what you're trying to measure.
Instead, you should consider looking at Event Tracking. Specifically, they allow for the tracking of 4 separate data points (per hit): 3 strings and a integer value.
So, you could use this to track when posts happen, or when comments happen on those posts, and then aggregate the values by whatever dimension you like using the API. You'd just need to bind the event to occur at the times you intend, with the data you want to track.
So, an example event call for you, tied to whenever someone posts a comment on a forum topic:
_gaq.push(['_trackEvent', 'Form Posts', 'Comment', topic_name, 1]);
You could then use the API to query particular views to tabulate whatever aspect of the event you want to aggregate. You can simulate those calls with the Google Analytics API Query Explorer. In this example, you could get number of Comments per day using Dimension set to ga:date, Metric set to ga:totalEvents, and then set the filter field to ga:eventAction==Comment

Resources