Need to group some pages on my site together but apparently content grouping would only be forward facing. Is there a way to apply content grouping to prior data or create a calculated column as such which would allow GA to filter and group older data?
Is there a way to apply content grouping to prior data?
No, content grouping only applies going forward.
or create a calculated column as such which would allow GA to filter
and group older data?
No, any data you add to GA is only available as of the moment you create it.
What you can do:
GA:
Use Query Filters (not view filters) or segments: filters/segments don't create any data, they just filter it. So if you create 1 filter/segment per group and query the data, you will effectively have the same data as if you had done content grouping
Use Regex: GA supports regular expression which might help you create the filters you need
Use the API: since applying filters/segments might be tedious to do (and repeat) via the UI, you might want to use the API, for instance via the Google Sheets GA API add-on (see further details below)
Example of Google Sheets GA API add-on query to group some content that would match all pages which start with /foo or /bar (see list of API dimensions and metrics, see legacy filters syntax):
ga:pagePath=~^/(foo|bar)
Once you have figured out 1 query for 1 group you can clone them, query all your data, and then reaggregate it.
Google Data Studio:
GDS has a feature called Calculated fields which effectively allows you to create content groupings which apply to both historical and new data. Most likely you want to do this with a CASE statement:
CASE
WHEN REGEXP_MATCH(Page,'^/(foo|bar)') THEN "Group A"
WHEN REGEXP_MATCH...
ELSE "Other"
END
Related
I'm trying to retrieve separately ga:userAgeBracket and ga:userGender using Google Analytics Report API v4 using a filter on eventCategory and eventAction.
From GA Dashboard, i'm able to retrieve the data even if there is only ~ 2.4k users and ~5.6k sessions. The repartition is 178 Males and 142 Females.
I'm trying to get the same result with the API but it's return nothing. I'm testing with https://ga-dev-tools.appspot.com/query-explorer with the same filters ect.
Is there any limit on the API ONLY when there is a small amount of data ? or another reason ?
EDIT: With another account with more data, and i still have the issue. Here are some screenshots
You created a segment in GA webUI and is comparing the results to "filters" in the explorer. You should be applying the same segment instead for consistency. Once you save the segment in webUI, it should be available in the "segment" field as a selection.
Your filtering also uses the "=~" regex match operator instead of the "=#" contains operator. Try this and you should have results.
I'm working with Google Analytics and i've come across a (not set) issue with Content Grouping. I changed my URL's in the month of August, and then most of the URL's went into the (not set) Content Grouping, instead of its specific group. Is there anything I can do to have the URL's put back into their correct grouping?
Also, i'm reporting out this data via Data Studio and I was wondering if there was a query/filter that I could use to have it be grouped into the correct content grouping?
The content groupings you have probably was dependent on the URL. You will need to modify your existing content groupings in GA and change the rules so that it matches the new URLs.
As for reporting in DataStudio, you can use CASE functions in a new calculated field. The cases will be the rules for your content groupings. Example:
CASE
WHEN REGEXP_MATCH(page, "(mypagepath1|mypagepath2|mypagepath3)") THEN "Group 1"
WHEN REGEXP_MATCH(page, "(mypagepath4|mypagepath5)" ) THEN "Group 2"
ELSE "No Group"
END
After that you will use the new calculated field in place of the content grouping dimension.
Welcome to StackOverflow. As #Sonali has already implied, you need to take into account the fact that GA is incapable of setting an 'if not set, use default' value on a dimension. If you can see any way of better interpreting the August data you do have, try using the GA plugin in Google Sheets: if you do that, and then use a Sheets formula to manipulate the data, you can then have GDS access the sheet.
I am trying to join data associated with two custom variables in the same Google Analytics dataset for a filter widget. We have institution names for older data in customVarValue2 and after GA changed the use of custom variables, newer data in Institution. I would like to be able to access all that data (back to October 2011) in one pageview chart and I think I can do that with a calculated field.
I saw on a post in the Data Studio forums that the logical operators don't work so I've been trying to do this with individual lines like so:
CASE
WHEN REGEXP_MATCH(customVarValue2, '.*Denmark.*') THEN 'Denmark!'
WHEN REGEXP_MATCH(Institution, '.*Denmark.*') THEN 'Denmark!'
ELSE 'Other'
END
The goal is to end up with one "Denmark!" field in the widget dropdown where all the data is combined from the two custom fields (customVarValue2 and Institution) to cover the whole date range. I can get it to work with one of the variables and it gives me the choice of "Denmark!" and "Other" with the appropriate date range for the custom variables that I used. But when I put both "WHEN" cases in, I only get "Other" showing in the widget dropdown. I would appreciate any advice you can give.
Thanks,
Sandy
The version below seems to work for me on a different case. Have you checked the case of the custom variable macthes?
CASE
WHEN REGEXP_MATCH(customVarValue2, '.Denmark.') OR REGEXP_MATCH(Institution, '.Denmark.') THEN 'Denmark!'
ELSE 'Other'
END
I have a site with a store search that posts in the following format.
www.site.com/store-locator?city=&province=&zip[postal_code]=68123
I am trying to configure GA to give me feedback on people visiting this page and a count of specific zips searched.
example report data
/store-locator?city=&province=&zip[postal_code]=68123 1000 visits
/store-locator?city=&province=&zip[postal_code]=68456 768 visits
/store-locator?city=&province=&zip[postal_code]=68789 221 visits
note: the 'city' and 'province' values may also be populated (and I will want to mod GA to give similar data on these too).
Can anyone give feedback on how to configure GA to give me data similar to this?
Thanks!
As far as I know, the only way to look at this type of segment historically is using individual segments, which doesn't work well for an arbitrary number of zip codes. However, you can collect this data more effectively as described for new traffic. This comes up often with information like categories, tags, dates, query string variables, etc.
You can create Segments for each zip. This will work for historical analysis, but is impractical beyond a few. https://support.google.com/analytics/answer/3124493?hl=en&ref_topic=3123779
You can also use Content Grouping to create groups. This will not work historically. https://support.google.com/analytics/answer/2853423
The way I've handled this is using Custom Dimensions, which replaced Custom Variables when Universal came out. This also only works for future data.
To use Custom Dimensions, you would pass the zip code to google analytics explicitly when calling the analytics javascript code.
You can pull querystrings with javascript, or echo the parameter using something like PHP as follows:
<?php
if (array_key_exists("zip",$_GET)) { $theZip = $_GET["zip"]; }
else { $theZip = "nozip"; }
?>
And, sending the custom dimension --
ga('create', 'UA-XXXXX');
ga('set', {'dimension1': '<?php echo $theZip; ?>'})
ga('send', 'pageview');
You also need to setup the custom dimension in the Analytics Profile. Docs on custom dimensions https://developers.google.com/analytics/devguides/platform/customdimsmets
/store-locator?city=&province=&zip[postal_code]=68123 1000 visits
Step 1: In GTM, create a new macro. I called mine {{province}}
Macto Type = URL
Component Type = Query
Query Key = province
This will populate the Macro with the value of province from the query string.
Step 2: In your Google Analytics property, define a custom dimension called "province". This will assign an index key to the dimension.
Step 3: In your GTM tag for Google Analytics, you will find Custom Dimensions under more settings. Add a new dimension, apply the index number from #2 and for the dimension select the macro you created from #1
Publish and you are all set.
Now when you look in Google Analytics, you can add a secondary dimension and choose your newly created custom dimension.
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.