I am currently using Google Analytics in my Application, where most of the pages are after login. I found an issue with GA, around unique user count. The problem is that if the same user logs in from different machines, then he is tracked as a new user, and if two users login from the same machine, it is tracked as one user. I would like to change the uniqueness algorithm for GA, to use my own accountIds as the unique key. Is this possible? If not, how can I address this problem?
You can do that with Universal Analytics, the new version of GA by generating a unqiue client id per logged in user and passing it to the tracker when it's being created.
ga('create', 'UA-XXXX-Y', {
'clientId': '35009a79-1a05-49d7-b876-2b884d0f825b'
});
(this is an example from Google UA Documentation, so while I haven't tested this yet I guess it should work).
did you try custom variables ? this may be suitable for your situation.
https://developers.google.com/analytics/devguides/collection/gajs/gaTrackingCustomVariables
Related
Problem: I need to see where users who download the app from the website, came from. We have google analytics(GA) and this part works well and we can see our traffic sources. However, I need to link users who install the app with those web visitors, so I can see from which channel, I get my "good users". The ones who ultimately install the app and set it up.
Solution Implemented: I have turned on the userID functionality and have session unification turned on. I am generating userIDs from the internal apis and publishing them to google analytics, the standard way. It is a PHP website and on session init, I make a call to the apis to get a new visitor id
$site_visitor_id = key_exists(static::USER_ID, $_SESSION) ? $_SESSION[static::USER_ID] : '';
$response = API::logWebVisitor(static::SITE_ID, $site_visitor_id, static::getClientIP());
if (!is_null($response)
&& key_exists('data', $response)
&& key_exists('visitor_id', $response['data'])) {
$_SESSION[static::USER_ID] = $response['data']['visitor_id'];
} else {
$_SESSION[static::USER_ID] = '';
}
which is pushed to google analytics.
ga('create', 'UA-XXXXXX-Y', 'auto');
ga('require', 'XXXXXX');
ga('set', 'userId', '<?php echo $_SESSION[Session::USER_ID] ?>');
ga('send', 'pageview');
This works as I have all the users I would expect in the userID view in GA. One a user installs the app a user is created in our internal apis and the ip address is recorded. Every 10 minutes I try to link the generated userIDs ( which also have an ip address associated with it), with the users, based on the ip address. When I find a link, I push an install event to GA.
cid=<randstring>
&ea=Install
&ec=<category>
&el=InstallID
&ev=<install_id>
&t=event&
&tid=UA-XXXXXXX-Y
&uid=<mygenerated_user_id>
I can see the GA events perfectly fine and that works. One caveat though, is that the measurement protocol requires the cid, even though it says if the uid is passed this is not needed(fake news). So I just generate a random id to pass in and it works.
Issue: When I look in the reporting views of GA, GA is not linking these events to the web visitors that have the same user_id associated with it. Now, I can't see any of the user_ids to filter down and verify this as GA does not provide me with access to this information.
Expectations: I would expect that when I send an install event to GA with the user_id that GA sees that there are two client_ids with the same user_id and links those together, so I can see what channel lead me to getting that user. However, it's as if GA has no clue who that user_id is and never links them together. I am struggling to figure out what I need to look into to figure out why.
Any information around GA would be helpful as I don't know much about it and it's my first time using it.
I integrated the Google Analytics User-ID feature on our website today (in combination with Google Tag Manager). It's working great for logged in users.
I use the UID of our system for logged in users.
Logged in user example
However, I am not sure which value has to be used for users that are not logged in.
Currently, it's just blank if the userId value can not be set because the user is not logged in yet.
Logged out user example
Is it okay if its just blank? Or do I have to set the value to something specific?
I thought about:
setting a Default Value for the Data Layer Variable for userId in the GTM
using the clientId that is stored in the _ga cookie
But I just don't know which what the correct thing to do is here. I can't find a clear answer to this online, and the Google Guides and Documentations don't expressively say anything about it either that I've seen.
I would really appreciate any help with this. And thank you in advance for your suggestions and answers!
Cheers!
When a user is logged out, you should just totally skip pushing the userId onto the dataLayer. In this case, the GTM userId variable will resolve to undefined (because it will not find such a key on the dataLayer) and Google Analytics will ignore it altogether and the &uid query parameter will not be sent to GA.
Ok so here is a scenario I would like to get some ideas on:
A user shows up to my site and registers for my service...lets call the service "vaporware".
After registration the user proceeds to view all the glorious features that my cloud based vaporware has to offer. Each feature that they use during their visit is recorded using Event Tracking in Google Analytics and I can effectively track engagement.
Now the problem:
One of the features in my Vapor product has tasks built in. These tasks are important for a number of reasons...they are recurring and do not require any action from the user to execute.
How would I using either "old" google analytics or the new Universal Analytics go about tying these "background events" visitors? I am thinking that the new Measurement Protocol may be have the answer as this perhaps can be considered cross platform tracking...
Regardless this keeps coming up a lot for me and am interested even finding a hack/work around to start recording these types of events in GA.
If they're logged in, you can substitute the autogenerated client ID with your own user/account ID (make sure to anonymize it before sending it to Google).
With the Measurement Protocol it's the cid parameter:
...v=1&tid=UA-XXXX-Y&cid=my-user-identifier&t=event...
In the Universal Analytics JS code, it would be something like this:
ga('create', 'UA-XXXX-Y', {
'clientId': 'my-user-identifier'
});
Hope this helps :)
I track my users behavior using Google Analytics client side. At some point the user is redirected to one of my partners and I receive a callback from the partner about the value the user has generated.
The question is: How do I append that value from the callback as a goal with a value to the users session?
The objective is to be able to get insights about which of my traffic sources generate the most value (and not just most conversions - as that could be tracked with event tracking).
The solution might be similar to this one, but I'm not sure it's still the best solution - and there could be others as well.
Using Google Analytics to track the same session in client javascript and server side tracking calls?
Thanks in advance.
So it seems that this is now possible with the new Universal Analytics from Google by saving/syncing the users UUID to the server and then tracking any relevant events.
https://developers.google.com/analytics/devguides/collection/analyticsjs/user-id
This package seems like a nice wrapper: https://www.npmjs.org/package/universal-analytics
Another option is to use same userId (not clientId). That works for multi-device tracking https://support.google.com/analytics/answer/3123662
Universal-analytics is better in that you can use it for anonymous users as well as signed-in users
But tracking by userId is better in that you can send events even if user is not currently on your website doing http or websocket requests.
Using the Google Analytics API I would like to display the domain associated with each GA profile. Is this possible or is there another way to do it? I have been unable to find any documentation for the domain.
http://code.google.com/apis/analytics/docs/gdata/gdataReferenceAccountFeed.html#accountResponse
http://code.google.com/apis/analytics/docs/mgmt/mgmtFeedReference.html#profileFeed
I can't use profileName because depending on how the user has their GA account setup, it may just be a string and not a domain.
One thing you might do is perform a query using ga:hostnames as the dimension and either ga:visits or ga:pageviews as metrics. This will yield a chart of the host name (what is in the browser address bar) to reach that site. Sort of a hack in a way. Technically you can use a single GA Tracking code on multiple sites. So there is no "Official" domain name associated with a profile.
Unfortunately, I don't think it's possible with the current API. Furthermore, you can't explicitly depend upon the domain they enter as the only domain the profile is tracking since there is further customization that allows the user to specify if they want to track subdomains and/or top-level domains. I believe your only option is to ask the user the same information Google asks the user and help the user understand they will have to manually keep two lists in sync due to limitations of the Google API.