Report all events with custom dimension not set (or empty) - google-analytics

I have user-scoped custom dimension and want to see if this dimension is applied to all required events.
I've generated custom report with "Event action" - "Event value" fields and trying to filter it by "Custom dimension" field.
The problem is that there is no such events - no events with empty "custom dimension" value.
Does filter requires custom dimension to be explicitly set (e.g. to empty string) or there is just no events with empty 'custom dimension' value ?

Got answer here: https://productforums.google.com/forum/#!msg/analytics/of_JM1g0lAM/tC59L07fVQgJ
Custom dimensions, like event dimensions, do not have a (not set) or empty value that can be queried. Only events with non-empty values will appear in your report. To get the rest, you need to get the all events total and subtract.

This may be an anti pattern, but technically, you could bypass this limitation by setting your dimensions to a default value.
{{MyCustomDimension}}-foo
Where your empty dimensions would display as -foo and forward.
If the dimension was supplied, you would expect to see it in analytics as the dimension value followed by -foo.
Take click events in google tag manager for example:
{{Click Element}}.{{Click Classes}}
In the example above, we can always expect click element to be defined, but not an elements class attribute.

Related

GA4 Custom Dimensions (not set)

I added a custom parameter to my transactions. I am receiving data as when I go to Reports> Realtime>View user snapshot and click on an event I can see the parameter name and a value which is good. I can also see the value when I go to Reports>Engagement>Events and chose and event and select my parameter in the 'Events in last 30 minutes tab'. The issue comes when I go to Explore and make a Free Form with my parameter as a row or column as the column would simply show '(not set)' even though I know it is set from the before views that I mentioned
Thank you
You will see a value of “not set” for a custom dimension during the first 48 hours after you create the custom dimension.

GA4 with GTM - sending the items array as an event parameter without using datalayer?

Using GA4 with GTM. I'm questioning how to send an array for an event. For example, the add_to_cart event. In my situation I am triggering the tag on my purchase links. On those links I added data parameters for the id, name, and value such as :
Buy Now
There are multiple and the id, name, and value are the only things that change for each link.
Google requires an items array to be sent with the add_to_cart event. Can I enter the items array as shown in this picture using dot notation? I can't supply this information in the datalayer which is why I am grabbing the values that can be different from the link itself (data parameters)... the rest are static and won't change. I can't find any way to create an array variable in GTM so the dot notation is the only thing I could think of.
Is there another way to do this I am missing or not thinking of?
Unfortunately you can't.
Your solution sends every value from the items object as an individual event parameter.
GA4 requires you to send an array of objects, with one object for every sold item.
The good news is, you can use GTM to create the items array in the correct format using some JavaScript.
#Ramon Put me in the right direction. Set this up as a custom js variable. Since I trigger the tag on link click the {{Click Element}} lets me get those data-parameter values from it to create the array values that are dynamic. I suppose I could have also used the gtm variables I already created for those here too. Anyways, I use this variable as the items event parameter value which returns the array how I wish. Seems to be working fine.
function(){
var e = {{Click Element}};
var items = [{
item_id: e.dataset.id,
name : e.dataset.name,
affiliation : 'some name',
currency : 'USD',
item_brand : 'some name',
item_category : 'Software',
price : e.dataset.value,
quantity : 1
}];
return items;
}

Custom dimension vs custom metric

Ok, I'm trying to track when the users get an empty list of products.
The list is defined by a filter, I want to first know if there's a lot of people getting empty results to take some action like tracking what's the filter combination they're using, anyhow...
To picture it, this is what I want to achieve:
But I'm confused between the custom dimension and custom metrics. In my head, all I need is a custom metric (Cause the amount of empty results sounds like a metric to me).
So I created an "Empty list results" custom metric with the scope of Hit. And I'm passing just an integer 1 to this custom metric.
But it doesn't show what I need. Am I missing something?
UPDATE
Including every hit to the page, even when I'm not sending the custom metric index/value pair
In this example:
/custom-metric-test-1 does not include the custom metric index/value
/custom-metric-test-2 does include the custom metric index/value
But they both show in the report. It's like my custom metric it's just an alias for hits.
You can use a metric or a dimension, it depends on the result you want to get (read), in all cases you can have the number of times a page has a certain characteristic (in your case the empty product list).
Use a custom report, i.e. with flat table, put 'page' as a dimension and your custom metric as a metric. Page and hit are the same scope so the queried pair of elements shouldn't give you strange results.

Google Tag Manager - Split single URL parameter into multiple custom dimensions

We have our Google AdWords campaigns and adgroups naming conventions set up in a predictable fashion. For instance utm_campaign will be "Description-Topic-Segment-Audience" and the adgroup will be "Targeting Tactic-Adgroup Topic-Adgroup Subtopic".
Currently I have a number of our query parameters pushed into custom dimensions via Google Tag Manager using a Universal Analytics tag.
Inside that tag are the Custom Dimensions mapping. The index will be a static variable we've set up ("CD - Index 1" with a value of 1, "CD - Index 2" with a value of 2, etc.) and the dimension value will other variables we have that use the Query Keys. So in the tag the table looks something like:
Index | Dimension Value
{{CD - Index 20}} {{CD - 20 - Value - Ad Used}}
{{CD - Index 21}} {{CD - 21 - Value - Ad Matchtype}}
When setting up the dimension value variables, I select the variable type as URL, the component type to Query, and the Query Key to be whatever parameter I'm trying to pass along. This allows me to strip them from our URLs in the views inside GA while still preserving the data and allowing us to slice and dice by various things.
Is there a way to parse a single query parameter into two or three separate chunks that could be put into their own custom dimension?
Thanks in advance!
Jason
You can use custom Javascript variables like
function () { return {{your_url_query_variable}}.split("separator");}
This variable will return an array of parameters that are divided by separator in your_url_query_variable.
You can store each element of this array in different custom dimensions like {{my_custom_js}}[0] for first element and so on.

Google.Analytics. Make a report on url parameters values

Is it possible to make a report, where lines of the table will be different url parameter values and other columns - say ecommerce (transactions, CR)?
There is no out of the box report.
To do that you would need to:
create custom dimensions in the property settings (you only have 20). Let's say you name them imaginatively parameter1 - parameter20
user filters to map the query parameter (lets say param1-param20) to the custom dimension.
create a custom report for your custom dimensions
Go to filters, custom, advanced. Set Field A First field Request URI. In the Extract A field you enter (for a GET parameter "param1") the expression param1=([^&.]*). This stores the value for param1 in a variable called $A1. Leave Field B and Extract B empty.
In "Output to" select the name of your custom dimension, in this case "parameter1". In Constructor enter $A1. This will map the value extracted from the parameter to your custom dimension.
Other options: Field A required "Yes", Field B required "No", Override Output Field "Yes", case sensitive "No".
Now wait a while until data has been collected. Then go to "customization", create a new custom report, select parameter1 (or any other of your custom dimensions) as dimension and add metrics at your gusto. The report will only show data for pageview where the dimension has been set.
You would probably create your custom dimensions at hit level (unless you are only interested in the last value in a user session), so combining them with conversion metrics like transactions might produce not particulary valid results.
If you have more than 20 different url parameters you want to capture you are out of luck.
(Btw. I'm not actually sure this is a on-topic question, but the answer has an regular expression in it so it might count. Still reporting questions are probably better suited for webmasters.stackexchange.org).

Resources