Get number of unique pages visited each day - google-analytics

Is there any way to get a number of unique pages visited each day from Google Analytics (API)?
I don't need the URLs themselves. Thanks!

Not as as such, but you can query for ga:pagePath and ga:pageViews - since you need some metric for the request to work at all - and then just look at the count for the number of results (which is part of the API response). Since each visited page will be a distinct row in the response, the number of rows is the number of distinct urls.
One drawback is that there might be multiple rows per Url if they have parameters (e.g. /foo.html and /foo.htm?bar=1 will be two rows), unless you have removed parameters in your GA configuration or via filters. So you may have to process the results (loop over the url list, remove parameters from the urls, and do you own aggregation).

Related

GA - how to exclude URL parameters?

The number of unique URLs exceeds the daily limit in our Google Analytics Analytics notification.
We tried to exclude URL Query Parameters in the View Settings but it doesn't work, GA continue to accept all this unique URLs. URL Query Parameters excluded.
Who knows how to solve this problem?
Daily hits will be reprocessed after midnight, so if you set correct parameters in exclusion list you can see URL cleaned tomorrow.

Bing web search API - limited number of records in result

I'm using Bing Web Search API v7, I'm sending following requests (selected few):
/bing/v7.0/search?q=mate%C5%99sk%C3%A1%20%C5%A1kola&count=50&offset=0&responseFilter=Webpages
/bing/v7.0/search?q=mate%C5%99sk%C3%A1%20%C5%A1kola&count=50&offset=50&responseFilter=Webpages
/bing/v7.0/search?q=mate%C5%99sk%C3%A1%20%C5%A1kola&count=50&offset=950&responseFilter=Webpages
/bing/v7.0/search?q=mate%C5%99sk%C3%A1%20%C5%A1kola&count=50&offset=1000&responseFilter=Webpages
/bing/v7.0/search?q=mate%C5%99sk%C3%A1%20%C5%A1kola&count=50&offset=1050&responseFilter=Webpages
First search query request with offset=0 returns 50 records, value
of totalEstimatedMatches > 50000.
Second request with offset=50 returns another 50 records, value of
totalEstimatedMatches is different, but still above 50000.
And so on with increasing offset (not presented above).
However, request with offset=1000 or any value offset >= 1000
provides result with records which are identical to records returned
in request offset=950.
This behavior in fact corresponds to MS Bing web search - when I click on page 101 with offset 1001 (or any higher page), I in fact get page 96 with offset 951.
So, I can't figure out any way to access more than 1000 results, even if there should be above 50000 of them (I'm aware that totalEstimatedMatches is only an estimate and the real value can differ).
Does anyone know how to get more than 1000 webpage results (more than 100 pages with 10 records / more than 20 pages with 50 records)?
Search engines optimize their index and return fewer results than totalEstimatedMatches to 1) Stop serving repetitive pages and 2) Focusing on relevance of top pages only. Bulk (if not 99.x%) of users alter query if they don't find results on first 2-3 pages. So maybe for search engines it is not worth storing index of billions of pages for a given query. Note that this behavior is common across all the search engines and not only Bing.

Can I filter a Google Analytics segment based on content grouping pageview count?

I want to create a Google Analytics segment for our users who view at least a certain number of pages on our site. From what I can tell (please correct me if I'm wrong) this is easy to do if you don't care about what kind of page they view: you create a filter for the segment that checks to see if Unique Pageviews is greater than some value such as 4. However our site has a whole bunch of pages that I don't really care if someone reads (our "about page" for example). So what I'm trying to do is create a segment of how many people view at least X pages of what we call "Learning Content" (basically two specific page types on our site). How can I segment the users who read a certain amount of learning content?
Two types of pages fit into our definition of learning content. The first one has a URL matching a regex that sort of looks like /learning_content_1/.* and the second matches regex /learning_content_2/.*. I've already created a content group for learning content that correctly identifies these two content groups. However I wasn't able to find any way to filter a segment based on how many unique pageviews (or even just pageviews) come from a specific content grouping. Is this even possible? If not, how might I work around that?
The research I've done so far: Google Analytics: How to segment by many groups of pages was somewhat helpful but didn't address the question of how to create an actual GA segment based on pageview information for a content grouping or content group.
The only way I can think of handling this, is by associating a specific custom event that gets triggered on this page. Then you can create a segment that matches users who have that event category:
and total events greater than 4:
It's a workaround, and it doesn't work if you are tracking other events, but maybe that works for you?

Google Analytics API: Creating arbitrary "dimensions" to group metrics

I have a requirement to programmatically get unique visitors grouped by partial matches on some fields. For example, assume I want to group my users by the source domain like "google" or "facebook".
A single user's visits might come in with a ga:source of "m.facebook.com" and then "www.facebook.com" on another visit, or "m.google.com" and "www.google.co.uk", etc. I can perform an API query specifying "ga:source" as the dimension, and it will give me the unique visitors for "m.facebook.com", "www.facebook.com", "m.google.com" and "www.google.co.uk" respectively. However users who visited via more than one of them in the requested period are counted in each group, so aggregating this data subsequently into "facebook" and "google" groups results in duplicate users being counted.
Would it be possible to group the "ga:source" dimension using a Regex (^(?:.*?\.)(.*?)(?:\..*) for instance) or some similar arbitrary mechanism so that I can get two groups of unique visitors instead: "facebook" and "google"?
I can of course, use filters to get each category and then perform multiple requests and that works fine, but being the lazy programmer I am, I was wondering if I could do it all in one go, or if anyone had alternative suggestions I haven't thought of.
The conclusion appears to be that the only way is indeed to submit a filtered query for each desired grouping of unique users. So I shall do that. :)

Request GA statistic data for a specific large set of pages

I've spent last few days trying to find a solution to solve problem below.
I have set of URLs for which I would like to request data - mainly pageviews and visits by months in specific time interval. These URL specify one web section and we would like to get statistics for this section. I'm using PHP GAPI.
I am able to construct correct filter for the URL set:
ga:pagePath==[url1]||ga:pagePath==[url2]||ga:pagePath==[url3]...
But this works for a fews URLs because request is sent via GET and there is request length limitation for GET.
At first I tried to make severeal requests for a few URLs from the whole set and after all requests (when I had data for all pages) I made sum of pageviews and visits. Than I realized that this could work for pageviews but not for visits (one particular visit could be counted in more than one response and thanks to sum it was counted muliple times).
And than i have these limitations:
I can't use regular expresion to shorten the filter. URLs of pages are badly designed (not thanks to us :) ) and the pages in a web section therefore don't have nice URL prefix like /my-section/*
I need historical data (2 years back), so it won't help to start tracking some custom variable or event for pages in particular web section from now.
So I tried to make POST request to API. I was able to get auth token, but POSTing request to get statistic data returns:
403 Forbidden
Target feed is read-only
I tried to find if there is actualy the possibility to use POST method, but had no luck finding exact info (some clues suggest that it is not possible).
Another idea could be redesigning URL to have some nice prefix to filter by regexp and somehow changing the stored URLs in GA, but I have a feeling that it's not possible either.
Does anyone have an idea how to solve this?
Thanks for any suggests :)

Resources