Google analytics - How to send values for custom dimension/metrics - google-analytics

I'm starting with google analytics and i don't realize how make it works.
We are making a site and we want to add the user name 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 couple weeks ago and i created a custom dimension (to know who user access) and a custom metric (to know how many visits made) as it's indicated in documentation.
The dimension and metric were 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('set', {
'dimension1': 'userName',
'metric1': 1
});
ga('send', 'pageview');
I've tried this code and others configurations but google analytics doesn't take the values.
Look this image (http://snag.gy/Ou8vG.jpg)
What i'm doing bad? it can be because i'm sending the request with 'pageview' and the dimension is scoped with session?

Finally worked!!
Apparently you must wait a time (like 2 days for me) before Google starts to record the information. Documentation not specified this detail.
I hope this answer helps other people with the same question!!

Related

GA: How much time have my 100 most "obsessed" users spent on my site

Does Google Analytics have enough information to answer the question of how much time have my top 100 users spent on my site? I don't need their user information, I don't care about ID or name which I know it doesn't even have. Just the identification of individual users by the cookie GA uses, and a report of how much time the top 100 loyal users spent on my site.
is such a thing possible at all with GA?
From your comment on Colwin's answer:
I don't need google if I have to track this for GA, I just hoped it already has this information such as "page visit duration" on a per-user, ongoing basis. If I had to feed Google that information myself, I can feed my own database and run analytics on it. Thanks anyway.
The Google analytics sessions is
a group of user interactions with your website that take place within a given time frame. For example a single session can contain multiple page views, events, social interactions, and ecommerce transactions.
Average session duration will be calculated as
total duration of all sessions / number of sessions
I don't think this is available from GA out of the box. But you can build something like this with Custom Dimensions available within GA
This will let you setup and send custom metrics dimensions for users that you can then create reports for.
Google Analytics doesn’t allow you to out in PII but random visitor id's should be fine. You can then compare against your own database outside of GA if needed too.
This will allow tracking the same visitor even without them being logged in to your site.
Sending the custom dimensions could possibly look like this.
ga('send', 'pageview', {
'dimension5': '1234567890'
});
You get 20 free custom dimension slots with GA and 200 with GA 360 -> More info here
I think this article has what you are looking for
https://webanalyticsguy.com/2018/01/18/google-analytics-capture-client-id-reporting-purposes/
It shows how to capture the client id which is a decent way to track a specific user. And goes further to explain how to associate that with a metric, in this case the author uses PageView.
You could change this to Average Session Duration or another metric that gives you a sense of time spent.
I guess that you are looking for something like this:
http://www.analytics-ninja.com/blog/2015/02/real-time-page-google-analytics.html
You can get the counts of the users on your site. You can get the seconds they spent on your website page.
I guess this answer will be helpful too: https://qr.ae/TWpkI0

Is Data Layer implementation necessary to push Custom Metrics and Custom Dimension data from Google Tag Manager to Google Analytics

As my heading suggest, I would like to know if it is necessary to implement a Data Layer to push Custom Metrics and Custom Dimension data from Google Tag Manager to Google Analytics.
Some guides I have seen seem to suggest you do not need to implement a Data Layer: http://mixedanalytics.com/blog/custom-metric-ga-google-tag-manager/
However, there are others that suggest you need to: https://campaigntail.com/Blog/Ultimate-Guide-Custom-Dimensions-Metrics-Google-Analytics
When I say implement a Data Layer, what I mean is insert code like this into your website:
// Set value for custom dimension #3.
ga('set', 'dimension3', 'variant a');
// Set value for custom metric #1.
ga('set', 'metric1', 1);
// Send pageview. Passes the dimension and metric to GA.
ga('send', 'pageview');
I have tried implementing the first method but failed. So was wondering what is the right way to go about it.
Thank you.
(Edited because of stupid). Your code example does not show a datalayer, it shows a part of Google Analytics tracking code that wouldn't event work with a standard GTM setup (because GTM uses unique tracker names).
A datalayer is an an array of JSON objects that you can use as a container for your data. However GTM is happy to accept data from almost anywhere, including values that are directly written into your tracking tags. So no, you do not need a datalayer (other than in the sense that GTM will automatically create the datalayer that it needs to function).
Remember the data takes some time (up to 24 hours) to show up, and custom dimensions/metrics are not part of the standard reports. You have to create custom reports, or select your custom dimensions as secondary dimension in a standard report.

How to find adwords GCLID id in google analytics and link it to conversions manually?

I'm using a 3rd party tracking software (tracking202) to track conversions (as I can use the google conversion tag directly on my site, for some reason). Now, I've complete tracking data including keywords, placement and IPs of the converted users. Now, since Auto Tagging is enabled in my adwords account, google used glid id on my URLs since the beginning. I want to upload conversion data to adwords through the offline conversions import feature. And for that, I've 2 queries:
Where do I find the gclid ID in google analytics?
How do I link the converted IPs with GCLIDs ? (Since I have the converted IPs list in tracking202, if there's a way to filter IPs in google analytics and set the GCLID as the secondary dimension.. I would be able to collect the converted GCLIDs. But I'm not sure if its posisble in google anlaytics.
Please suggest what I can do in this case. Thanks a lot.
Google Analytics does not make the glcid accessible via the interface. If you want to get at the gclid you would have to store them yourself in a session scoped custom dimension (obviously this will not work for data already collected).
You need to create the custom dimension in the property settings (under "Custom Definitions") and then add a bit to your tracking code (poorly written PHP code for demonstration purposes only):
ga('create', 'UA-XXXX-Y', 'auto');
<?php if(isset($_GET['gclid'])) { ?>
// Set value for custom dimension at index 1.
ga('set', 'dimension1', $_GET['gclid']);
<?php } ?>
// Send the custom dimension value with a pageview hit.
ga('send', 'pageview');
i.e. "if there is a query string variable called glcid assign it's value to the custom dimension with the numeric index 1".
Technically the same works for the client IP address (which is likewise not displayed in the GA interface or exposed via the API). However you must not (as stipulated by the Google TOS) store information that allow to identify a user in Analytics (it might depend on your legislature if IP addresses are personally identifiable information. I don't know Googles stance on this, but it would be illegal in the Europe, at least without explicit consent of the user).
You may however store an anonymous identifier that allows to pull information from GA and connect it to information stored in other systems, so if you store e.g. the strongly hashed IP both in GA and in your other tracking system then you can use this as a key field to merge the records outside of GA.

Google Analytics and Marketo RTP Link

I am trying to link Marketo with Google's Universal Analytics. In the link here (https://docs.marketo.com/display/public/DOCS/Integrate+RTP+with+Google+Universal+Analytics) and they do a great job at telling you the easy things. The tricky part is implementing the code.
As an example, UA will give you like this:
var dimensionValue = 'SOME_DIMENSION_VALUE';
ga('set', 'dimension1', dimensionValue);
You can push this with pageview as it is set on session but I have not been able to find what they want you to use as 'dimensionValue.' Has anyone successfully integrated the two systems in there UA?
Any help will give you instant karma points.
Cheers,
Shaun
In most cases you don't need to code anything. You just need to assign the relevant dimension to the relevant slot. This is done in the UI under account-settings.
If you want to dynamically assign value via GA code then you'll need to use the RTP API so that you can assign the relevant value you want: http://developers.marketo.com/documentation/websites/rtp-get-visitor-data-api/
Another option is using segment(push to analytics) or to create an audience under RTP UI.
Hope that helps.
M.

Google analytics viewing access by userID

I have asked this question several times over on the GA forum, but no result. So maybe you guys can help...
I have set up google analytics with userIds on various pages of a site, with the aim of identifying exactly which pages are looked at by which users. So, sending GA the string
ga('create', 'UA-39536320-1', {'userId': '1001'});
means GA keeps track of all accesses by user 1001, and I can then (in theory) track all pages looked at by this user.
Trouble is, GA reporting seems to offer no out-of-the-box way of doing this. Indeed, some of the reporting features supposedly enabled by GA with userIds just don't seem to be available (eg coverage; user engagement; etc).
Am I the only one trying to do this? Seems other people have achieved a similar result using custom variables; do I have to do that, and give up on GA userIds?
The userId feature can be used in conjunction with a user id enabled view (profile) to analyze cross device sessions.
As pointed out by DalmTo it is possible to use custom dimensions to track any non PII information about a user. This article here gives a good example combining sending user scoped custom dimensions along with imported CRM user data to analyze and segments users for remarketing purposes.

Resources