Sending a custom dimension to Google Analytics using the Google Measurement Protocol - google-analytics

I am currently trying to send a hit to Google Analytics from my CRM. I have been successful in sending events and purchase as well as products etc. However, when I try to send through a custom dimension I am not seeing this dimension within the user explorer section of Google Analytics.
My example case as follows:
I go to the Google Analytics Hit builder to build a prototype hit for this interaction found here
I send through an event to Analytics as follows; this contains the all important custom dimension:
v = 1
t = event
tid = {{Analytics account ID}}
cid = {{Random string}}
ec = Offline sales
ea = Completed sale
el = Oflline sale completed
ni = 1
cd4 = Sale made
(Don't run the above, you need to enter it into the respective fields in the hit builder)
I validate this hit and as you can see below it will show valid and will send
Image of valid hit
The event shows up in the real time events
However, the custom dimension never shows up in Analytic's user explorer
Could someone please assist?

Since you specifically mention the user explorer report my educated guess would be that your custom dimension is not user scope (which is the only scope the user explorer will show).
Look if you can select them as secondary dimension in your standard reports or build a custom report (or rather more straightforward, check the scope of your dimension in the property settings)

Related

Google Analytics shows real time goal hits but they are not reflected on the conversions report after >72 hours

I am trying to send events from my backend to Google Analytics via measurement API. Nodejs code below.
const url = 'https://www.google-analytics.com/collect?v=1&t=event&tid=' + tid + '&uid=' + uid + '&ec=' + ec + '&ea=' + ea + '&el=' + el+ '&ev=' ev;
const response = await axios.post(url);
The uid is a system generated UUID assigned to the user.
In Google Analytics real-time view, I can see the event and conversion reported but the goal values aren't updated in the other reports (waited over 3 days - and in another instance, over a week). I checked the Google Analytics Query Explorer but the events aren't retrieved there either.
I've already verified that the date range is selected correctly on the reports and tried creating another view but to the same effect. It is worth noting that client/browser side events are reported normally on this account/property/view.
Any idea why that might happen please?
If you are sending the only uid parameter without the cid you will be able to see those hits only in your User-ID view (if exists). If you want to see the data in the normal view reports you have to send a clientId (cid).

reporting on event hits in google analytics

I have been tasked with using Google Analytics to report of use of a desktop app so we can see which parts of the program are being used and how heavily, and potentially also see which companies are using which parts of the program (each company has a unique companyID). Ideally I'd like to be able to look at correlations (e.g., How many users who use report A also use process B?)
I currently have my program set to fire off a call to analytics. I've set it up to use the event tracking, but I'm open to app/screen tracking or something else if something would work better. I'm passing values like
v=1
&t=event // Event hit type
&tid=UA-XXXXX-Y // our ID; real code has valid value here
&cid=12345 // CustomerID
&ec=JobFinancialReport // Event Category
&ea=Run // Event Action
&el=Manager // Event label
&ev=7 // Event value
What I can't figure out is how in Google Analytics to set up reports that would show me something like:
CustomerID Category Label Total Hits Unique Users
12345 JobFinancialReport Manager 27 2
12345 MarketingReport1 Manager 6 4
I'm totally new to analytics so pardon my ignorance if I have some key misconception here. I've searched Googles sites and other questions here, but I may be wording my question incorrectly so I'm not finding something that's there. This is only one example; in some cases we might want to see how broadly each customer is using the program; in other cases we'd want to take the customerID out and just see how much a particular report is being used overall. Appreciate any guidance. Thanks.
The "cid" parameter is the client id, the value that is used to stitch single interactions into sessions and users.
The first problem that comes to mind with your setup is that the client id is not exposed in the user interface (with the single exception of the user explorer report) or the API.
You would need to implement this via a custom dimension (probably user scope, since it probably will never change for a given user) where you pass in the client id (you still need the cid parameter).
Then you could create a custom report (or create a report in Google Data Studio) with the custom value as primary dimension and your selected metric.
If you want to report "Unique Users" you would probably need to create a cid per logged-in user (if all users of the app have the same cid then you will always have but a single user reported). You should then probably create a second custom dimension for the company id, so you can segment your reports by company.
you can use custom reports in google analytics to get your desired output. here is how to create custom reports https://support.google.com/analytics/answer/1151300?hl=en

Google Analytics - Using Client ID as a custom dimension

Can I use client ID as a dimension in my reports? Client ID does not appear as a dimension in the Dimensions and Metrics Explorer, but I believe I can create a custom dimension that will store the Client ID. My end goal is to have a row per customer/date+time containing the incidents associated with the particular customer at the particular time, e.g. page visits, particular events etc
Once you've created the custom dimension in GA, you can start tracking it via analytics.js with the following code:
ga(function(tracker) {
// Assumes dimension is at index 1.
tracker.set('dimension1', tracker.get('clientId'));
});
I found that the google analytics will NOT save your custom dimension if it matches the value of "client id" (even if that id isn't actually PII). However, if you alter the "client id" to become a different value, it will save properly.
Here are the guidelines about what you are allowed to send

Does Google Analytics support real time reporting for custom dimensions?

I've already verified that my GTM and GA are linked correctly, and I've got a couple of virtual pageviews working (i.e. I can see them in the GA realtime report). But, I'd like to attach some metadata to these virtual pageviews, and I thought I'd accomplish this using custom dimensions.
This is how I've got it setup. In my pageview tag (the one that corresponds to a virtual pageview), I've set a couple of custom dimensions, as such:
Index | Dimension
1 | {{D1}}
2 | {{D2}}
where D1, and D2 are dataLayer variable macros.
I've also made sure to create these custom dimensions in my GA properties. Both are user scoped and have names that correspond to the dataLayer variable name (not the macro name).
I've set my GTM container to preview mode and checked the requests being sent, and the dimension looks like it's being sent correctly:
Dimension: {1: "d1 val", 2: "d2 val"}
Lastly, I'm setting these fields accordingly in the dataLayer whenever a fire a virtual pageview event (that triggers the pageview tag with the virtual url).
However, I'm not sure where to look for them in my GA report. They don't appear to be anywhere in the realtime report.
That gets me wondering, are custom dimensions not supported in real time reporting and I simply should just wait for GA to process them? Or should I assume something's wrong with how I'm setting it up?
They are not supported at this time.
Here is a list of the supported realtime dimensions and metrics:
https://developers.google.com/analytics/devguides/reporting/realtime/dimsmets/

How can I link my customers with ganalytics visitor

Most of my website traffic come from adwords, and fill a form to get called.
When A user fill a form, I have a customer created on my database.
For my business strategy, I want to know how much I payed for that lead, and how much benefit I make with it after the call.
For that I think I have to link analytics visitors and my customers directly.
I am searching for a way to put an analytics visitor ID on the request form or something like this...
You would need to get the visitor id and pass it into either a custom variable (ga.js) or custom dimension (analytics.js).
To get the visitor id for Google Analytics (ga.js) *I got this code from How to obtain Google Analytics visitor unique id? SO Answer:
_gaq.push(function(){
var tracker = _gat._getTrackers()[0];
var visit_code = tracker._visitCode();
console.log(visit_code);
});
To get the visitor id for Universal Analytics (analytics.js) *More documentation on this in Google's documentation:
ga(function(tracker) {
var clientId = tracker.get('clientId');
});
I've used this before, too:
ga.getAll()[0].get('clientId');
The best strategy in your case is:
Get user ID from GA or UA(as desribed advisor above)
Send user ID to database
Set up user ID as custom variable(in Googl Analytics) or custom dimension(in Universal Analytics)
Set up custom reports, where you can segment your visitors by their ID's

Resources