Google Analytics Custom Dimension Not Being Set - google-analytics

I've recently upgraded our site to use Universal Analytics and am trying to get some custom dimensions to work. However, no custom dimension data appears to be logged. Below is an example of my code.
ga('create', 'UA-XXXXX', 'test.com');
ga('send', 'pageview');
ga('set', 'dimension1', '149377');
Do I need to set custom dimensions before sending pageview?

A dimension is sent along with the either a page view or an event. It won't get sent by itself. So you should switch the order of the 'send' and 'set', then look in the network to see the page view call and you should see the dimension as one of the parameters.
Note that you will see the dimension data in google analytics with a delay of a day or so.

I had the same problem, took me a while to find out its cause...
That's correct by the way, that is you must do the SET before the SEND.
Here is the official documentation (see section "Collection"):
[...] Unlike other types of data, custom dimensions and metrics are sent to Google Analytics as parameters attached to other hits, like pageviews, events, or ecommerce transactions. As such, custom dimension or metric values need to be set before a tracking call is made in order for that value to be sent to Google Analytics.
For example, to set a custom dimension value, your code might look like this:
ga('create', 'UA-XXXX-Y', 'auto');
// Set value for custom dimension at index 1.
ga('set', 'dimension1', 'Level 1');
// Send the custom dimension value with a pageview hit.
ga('send', 'pageview');
Cfr. https://support.google.com/analytics/answer/2709828?hl=en

Related

Custom dimensions values passed over, but not available in google analytics

html code:
ga('send', 'pageview', {
'dimension1': '#useType',
'dimension2': '#artType'
});
The custom dimensions values are right in google tag assistant.
In google analytics, i added both the custom dimensions in admin settings page. But I couldn't see the passed over values in google analytics.
Am i missing any configuration?
Kindly help.

Multiple Tracking IDs for Single site without named tracker

In one of my client site, I am seeing multiple tracker IDs without any named tracker. I don't understand why we need multiple tracking IDs for single site?
ga('create', 'UA-XXXXXXXX-1', 'auto');
ga('create', 'UA-XXXXXXXX-2', 'auto');
ga('send', 'pageview')
I'm new to Google Analytics.
You do not need multiple tracking ids for a single site. This is simply an error. The second tracker instance will immediately overwrite the first one, and hits will be recorded for the second property only.

Google Analytics: Set content group when sending virtual pageview

Is it possible to set a content group for a virtual pageview?
As a user moves through the stages in my one page checkout I use virtual pageviews to track their progress in Google Analytics, like so:
// Moves to address section
ga('send', 'pageview', '/checkout/address');
// Moves to payment section
ga('send', 'pageview', '/checkout/payment');
Throughout the site I use content grouping to group similar pages together, using the tracking code method e.g.
// Product pages
ga('set', 'contentGroup1', 'Product ');
// Category pages
ga('set', 'contentGroup1', 'Category');
I want to do the same for the checkout so I can report on all of these pageviews together if required.
Is there a way to set the content group for a virtual pageview using tracking code?
You should be able to set the CG for your VPVs in the same way that you set it for your normal page views. Just remember that when you use the set method, it will apply to all hits until it is changed or until you load another page.

Google Analytics: send Content Grouping without a pageview?

I am implementing Content Grouping on my Wordpress website using the tracking code method.
I understand from the official documentation that the tracking code should be inserted before a pageview, that is,
ga('set', 'contentGroup1', 'Blog')
alone won't fire but
ga('set', 'contentGroup1', 'Blog');
ga('send', 'pageview');
will. My question is:
Is there a way to send the grouping information without relying on a pageview?
I have tried sending an event rather than a pageview, but it didn't work.
I am asking because I am using a Wordpress plugin to inject the default GA tracking code, and I would like not to mess with it.
Thank you for your time!
Content groupings can be applied to events, and not just pageviews. When you send in an event hit, you can go to the Events > Pages reports to see if a particular page associated with an event falls into a specific content grouping.
One of the caveats is that the content groupings report under Site Content > All Pages report is different from the Events > Pages report. The former categorizes only pageviews, whereas the latter categorizes pages associated with an event.
Note that if you use the 'set' method to set the content group as you've done before the pageview hit, all subsequent hits for the page (events, pageviews, transactions, etc.) will be associated with the specified content group (ie. "Blog").

I am trying to set value for custom dimension in google analytics for my website

I'm new to google analytics and i don't realize how make it works.
We have a website and we want to capture the customerId as custom variable in google analytics in order to analyze the behavior of each user with the site.
For this, i start to use google analytics (analytics.js) a few days ago and i created a custom dimension (to know who user access).
The dimension was created with session scope because those values must be sent once per session.
After that, i add the code needed as is explained here:
ga('create', 'UA-#######-1', 'domain.com');
ga('send', 'pageview', { 'dimension1': '<%Convert.ToString(Session["SelectedCustomerID"]);%>' });
I've tried this code and others configurations but google analytics doesn't take the values.
What i'm doing bad? Please suggest me a way to capture the information.

Resources