google analytics op_scope for page tracking - google-analytics

Javascript Google Analytics provides a setCustomVar method that allows us to submit custom data that will appear on the reports. I'm not clear on the opt_scope parameter however:
opt_scope Optional. The scope used for the custom variable. Possible values are 1 for visitor-level, 2 for session-level, and 3 for page-level.
https://developers.google.com/analytics/devguides/collection/gajs/methods/gaJSApiBasicConfiguration#_gat.GA_Tracker_._setCustomVar
Where can I find more information about these three options?

Tracking Custom Variables has a good description of the custom variable scope in Google Analytics.
Each of these three levels of interaction defines a specific scope of visitor engagement. This distinction is important to custom variables because each custom variable is restricted to a particular scope. For example, you might want to know the number of sessions where visitors removed an item from their shopping cart. For that particular case, you would define the custom variable to the session level, so that the entire session for that visitor is flagged as one in which items were removed from online carts.

Related

What custom dimension values should be used when creating GA4 dimension for Microsoft Clarity?

MY QUESTION
What should I select when creating the custom GA4 dimension to integrate Google Analytics with Clarity?
MORE INFO
The documentation says to remember the Event Parameter Name (so I know the scope = event) but it does not discuss the other variables that are required fields.
1. ☒ Scope = Event
2. ☐ User Property/Parameter?
WHAT I TRIED
Based on some Google documentation I first tried using this to pick up the dom title.
User Property/Parameter = page.title
This is picking up data from GA, however, when I tested this prior to production use, the data looked different and showed user traffic rather than number of events.
CONCLUSION
Can we get more information around how Clarity and GA work together, specifically the GA4 component?

What is the proper way to tag pages in Google Analytics?

I don't even know if "tagging pages" is what I mean.
Essentially, I have a large education website with many types of pages. Specifically, I want to tag our program pages by faculty, level, etc. For example, the Biology program page would be tagged with Science (as its faculty), and Undergraduate (as its level). It's possible that a program could belong to multiple faculties and/or levels (Psychology, for instance, is both a Science program and an Arts program). There is nothing in the URL to signify faculty or level. The website is built in Drupal, in case you know of any modules that could facilitate this.
I want to understand how different faculties/levels/etc perform. I will be building reports in Google Data Studio.
Any guidance would be appreciated!
What you are looking for is called 'content grouping'. If you haven't information in the URL you can define some rules when the page loads and pass the information to Analytics with the pageviews.
You can find more information here:
https://support.google.com/analytics/answer/2853423?hl=en
Then you can get these information from Data Studio.
Because of your multi-value needs, nothing in GA is going to satisfy your requirements out of the box. You will have to do some post-processing, and I am not familiar enough with Data Studio to know where its limits are in that regard.
As the previous poster suggested, Content Grouping is the standard way to create custom aggregations of pages. You can have multiple content groupings, such as Faculty and Level, but a page can be in only one group per grouping (not the clearest terminology but it appears to be what Google uses).
A different option is Custom Dimensions. There are two options here. One is to create custom dimensions for Level and Faculty. Each page can still have only one value per dimension, but you could send a comma-delimited string when a department is in multiple faculties (for instance) and then pull it apart again in a spreadsheet.
The second option is to create a custom dimension for Department directly, and associate each department to the appropriate one or more faculties and levels in your reporting.
How you set the custom dimensions or content grouping will depend on your implementation of GA. If you are using the Google Analytics Drupal module, it says it supports setting custom dimensions as a feature. If you are using Google Tag Manager you can set the dimension value in your tags directly, though of course it will need to decide what value to set on based on either totally enumerated rules you write or something it can read out of the page. Here is some Tag Manager documentation: Content Grouping via GTM; Custom Dimensions via GTM.
If the department is present in the page in some consistently marked-up way you can grab it; if not the Metatag module or one of its schema.org extensions might be able to provide you a spot to set a value for GTM to retrieve.

Track everything inside GA using only one custom dimension and one custom metric

What are the drawbacks of using a single custom dimension and a single custom metric in GA to track everything?
Ok, I am limited to 20 custom dimensions and 20 custom metrics for a property in GA. But the number of values for a single dimension is unlimited.
So, I will be able to, for example, create a dimension called Dimensio and a metric called Metri. Then, if I want to track a custom event called Ev1 I will tag on Dimensio with value Ev1 and on Metri with value 1.
I am just suspicious, why having such a solution GA ever worried about having 20 dimensions and 20 metrics (it would be enough to have 1 dimension and 1 metric).
Thank you.
There are numerous reasons/use cases where you'd want more than 1 dimension. I'd suggest some reading on scope.
One use case that will break the 1 dimension usage:
For a music streaming service, you want to track the user type (premium vs free) and as well as the version of the app (v1.0.1 vs v1.0.2) for debugging purposes.
The user type should be on a user scope, as in it will persist as long as the user doesn't clear their cookies. The version might be on a hit scope, as you might push out an emergency fix part way through the user session.
Using the above use case, you cannot report on the user type as well as version in the same report if you were only using one dimension.

What is a 'product' in Google Analytics?

In plain English, what is a 'product' in Google Analytics?
I ask because I'm trying to work out which Custom Metrics to set to Scope:Hit and which to set to Scope:Product. I assume a "hit" is just like the website hits we used to talk about in the 90s. But Google's explanation only makes sense if you also know what they mean by "product".
When a custom dimension has product-level scope, the value is only
applied to the product with which the value is set. Because multiple
products can be sent in a single hit, multiple product-level scoped
custom dimensions can be sent in a single hit.
As far as I know product data only exists with the new enhanced e-commerce-features** and is identified by one of the (unique) fields "id" or "name". There a several optional fields to add product details (see documentation).
The difference between "normal" and enhaced e-commerce tracking is that previously product data was recorded only on the confirmation pages, now you can do stuff like tracking a shopping basket or product lists (plus you need a different tracking library and a different syntax).
** At least all examples I found refered to enhanced ecommerce tracking and the classic e-commerce tracking does not have an "id" field. However the documentation does not explicitly say that product scope does not work with classic ecommerce, that's just an educated guess if mine.

Google Analytics segmentation customvar vs uri

I want to be able segment analytics data by company once my customers have logged into my website. Being very new to analytics, it seems like there is a couple of ways I could do this.
Set a visitor level custom variable that would signify the company. For instance, _setCustomVar(1, 'customer', 'ABC Corp', 1)
Pass in a custom Url to my _trackPageview calls whose first segment would signify the company. For instance, _trackPageview('/ABCCorp/the rest of the document path, querystring, etc.')
It seems you can't filter on a custom variable so I could not create a view\profile for each company but I could use Segments and Custom Reports off an 'All Web Site Data' view to do that instead.
Going the custom url route seems to be more flexible since I could either filter or use segments.
Are there any other pitfalls or reasons to suggest using one of these two approaches over the other?
This use case is better suited for custom variables.
Changing the URL will make it more difficult to do things like "How many home page views did I get" or "What do clients usually do after they login".
Also, you can create custom reports based on the information you're passing back and include the custom variable information as the first key. Pretty easy to duplicate GA's current top reports in a custom report using the custom variable as the main dimension.
Agree with Tom that CustomVar is a much better and cleaner solution.
You might want to switch to new Universal Analytics and use Custom Dimenions instead. It's even better and you can set up property filters with Custom Dimenions too, so this should cover all your needs.

Resources