Google Analytics API - filter dimension sourceMedium - google-analytics

I would like to filter certain sources and mediums (specifically email clients). I need to keep the dimension as one column (I use the maximum number of dimensions - 7).
The filter works fine when I have only one sourceMedium such as:
ga:sourceMedium!=amail.centrum.cz / referral
Filter doesn’t work at all when I use two sourceMedium:
ga:sourceMedium!=amail.centrum.cz / referral,ga:sourceMedium!=mail.google.com / referral
It doesn’t matter If I use AND / OR, the query doesn’t output the desired data.
I assume that there supposed to be some delimiter which could identify that amail.centrum.cz is one string which is delimited by another one. I already tried to use ' at the beginning and at the end of the string, but it seems that it doesn’t work.
Is there anything that I missed in docs or anything else? Looking for your help :)
BTW: I'm aware of the solution: Pull out data from GA, filter data manually (compare output data vs my list of email clients what I would like to exclude)

Related

How does one remove numeric id ending for restful URL in Google Analytics?

In Google Analytics, we track urls such as
/app/person/1
/app/person/78
or
/app/person/pet/456
/app/person/pet/65
And we'd like to remove the final Identifier so we can report on the page itself (i.e. /app/person and /app/person/pet)
Is there a way to do this? Thanks!
2 ways:
Search/Replace Filters: this will overwrite the original URLs with the non-numeric ones (if you ever want to know the exact original URL you're screwed).
Content Grouping: this will retain the original URLs, but will create a separate reporting option whereby you can switch from original URLs to your content group (see below example showing the page type, but you can really do whatever you want with content groups, including non-numeric IDs):
In both cases, you'll need a regular expression to handle the conversion: ([^0-9]+)/[0-9]+ should work (note that with GA's regular expression engine you do not need to escape /)
Accordingly the content grouping setup would look like:

Is it possible to select more than one status in the WooCommerce API orders endpoint?

I am reading orders from a WooCommerce site with the REST API (v1, OAuth), filtering for order status:
http://mypage.com/wc-api/v1/orders?status=on-hold
Works fine.
Now I would like to filter for multiple statuses. Is this possible? Like:
http://mypage.com/wc-api/v1/orders?status=on-hold,pending
This site suggests so:
You can retrieve orders with a specific status using the ?status parameter, using commas to separate multiple statuses.
(I've already tried, but I was not able to build a valid oauth_signature with the comma, probably some kind of encoding issue. So before I keep trying, I would like to know if multiple statuses are possible in the first place.)
I finally found the reason for not being able to build a correct oauth_signature: the comma has to be double-encoded (see here for details).
Answer: yes - it is possible to select multiple statuses comma-delimited just like that:
http://mypage.com/wc-api/v1/orders?status=on-hold,pending
This works in both v1 and v2.

Using filters to track hits for multiple URLs

We have a large website that is split up into groups of organisations with a number of micro-sites. We would like to provide one organisation within a group with their own set of data and I am having troubling getting the filtering working.
I think my main problem is I have 2 include filters. According to the documentation:
"If you apply multiple Include Filters, the hit must match every applied Include Filter in order to save the hit."
Our website urls would go something like this: https://[host]/[group]/[site]/[params]. I would like to track the following, given that this client (id 9) is in group "foo":
https://mysite.com/foo/live/default.aspx?id=9
https://mysite.com/foo/live/?id=9
https://mysite.com/foo/reporting/9/*
so that any hits on those urls would be captured for this particular client.
Our 2 current filters (type="Include") are as follows:
/foo/Reporting/9/
/foo/[^\?]*\?id=9
but these do not seem to track everything we think they should. Any help would be much appreciated.
By the time the first filter is done there is nothing left for the second filter to match - the first filter throws everything away that does not match (that's what Google means by "the hit must match every applied Include Filter").
I would suggest you first use an advanced filter to transform your urls so they follow all the same pattern (i.e. grab the value from the query parameter and append it to the url path) and then apply the include filter. I'm pretty certain that would be easier than trying to include different url structures (if you need help with the filters holler away in the comments, but the example given in the advanced filters interface should give you a clue how this works).

Google Analytics API: how to get non-US visitors

I have been using visitors with ga:country filters to get specific country's visitors. For example to get the number of visitors from US, I used the filter of 'ga:country==United%20States'. But I am wondering if I can do something like 'ga:country!=United%20States'? I guess I can subtract ga:country==United%20States from total visitors but I am wondering.
The easet way of doing this is to create a filter ga:country. A filter will let you remove a subset of the data returned by a query. Think of it like a where clause in SQL.
Filter=ga:country!%3DUnited%20States
That translates to
Filter=ga:country != United States
I made a simple report on my personal dashboard the Google Analtyics to test it.
Added info on filtering:
You can add more then one filter by seprateing
OR operator is defined using a comma (,).
AND operator is defined using a semi-colon (;).
You can mix and match Metric and Dimensions in the same filter.

How can I get results for a dimension (custom variables), where the value is not set?

I am using custom variables to track order ids. In order to aggregate analytics data into out data warehouse, I want to select a number of metrics with the custom variable as a dimension. However, if I do so, I will not get the entries where the variable is not set (E.g. sessions that didn't result in a sale). I need to get these as well.
Can I write a filter or segment that selects only the entries that doesn't have a particular custom variable? I have tried:
segment=dynamic::ga:customVarValue1==
But that doesn't seem to work (It gives no results back).
Basically I'm looking for the equivalent to where ga:customVarValue1 is null in sql.
In short, it's not possible to get the nullset data, as explained by a Google rep:
For some dimensions, GA uses the default value of (not set).
Custom Variable do not have a default value, so if a hit does not have a
custom variable associated with it, all the other dimensions in the query
are not added to the reports.
The original answer is a little confusing, but when you read between the lines it suggests that they throw out these "empty" values when they run their aggregates.
The "correct" approach, as he explains, is to set a default value for any row you want reported:
If you need to see the (not set) value, you could try sending a default
value for custom variables.
For example if you use visitor level custom vars to track member vs
non-member, you should always set non-member as a default for everybody;
then modify to member once they register.
Details are here: http://groups.google.com/group/google-analytics-data-export-api/browse_thread/thread/cd078ddb26ca18d5?pli=1
I've just had some success solving this by using a Regex to capture users or sessions where the custom dimension has no value. In my case I want to separate logged in and logged out users.
The Regex .+ will capture any non-empty value, so can be used to get the job done.
The filters for my Returning users segment is matches regex: .+ like this:
For the Customer prospects I used: does not match regex: .+ like this:
It's early days, but this appears to be working:

Resources