Google Analytics - measurement protocol events not linking to other events - google-analytics

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.

Related

Tracking offline conversions with Google Analytics

On a website with affiliate links, where there is no programmatic access to the conversion logs, I treat it as offline conversions.
My Setup
Online
A user visit my website, see the affiliated ad and a promotion view hit is being sent.
When the user clicks the ad, a promotion click hit is being sent and the user is redirected to another page on my site.
On the "redirection page", an product view hit is being sent, and the user is being redirected to the affiliation link, passing his Google Analytics clientId.
Offline
Once a week I download the stats from the affiliate program, which looks something like:
clientId visits conversions revenue
4444444444.3333333333 1 0 $0
1234567890.1234567890 1 1 $16.40
Then I use the Measurement Protocol to send offline events:
For each line of visit, I send a product click hit.
For each line of conversion, I send a product purchase hit.
My Problem
The conversion shows up on the eCommerce report:
Because the offline hits are being sent after the original session is already closed, a new session is opened which doesn't contain the info about the user.
So I can't see the conversion on the demographic report, for example:
Optional Solution?
I'm thinking of using the user-id feature of Google Analytics.
Even though the users are not identified, I can identify them by their clientId.
Sure, this is not what Google intended when they introduced that feature, but I believe it will solve my issue. I'm just not sure about the negatives.
My Questions
Any feedback on my setup?
Why is it even necessary to pass the clientId after the session is closed? what kind of information is being shared between the real session and the offline hit?
Is it a bad idea to pass the clientId as a userId to Google Analytics? Why?
Relevant Articles
A Comprehensive Guide to Tracking Offline Interactions in Google Analytics using the Measurement Protocol
Google Universal Analytics isn’t Linking Offline and Online User Properly
We were able to link offline action through as you did with measurement protocol but the problem is that those sessions are not included in demographic and age report.
Rather looking those report I used them to do segmented analysis E.g. pages they have look at, sources they used to come also I used it with attribution model to understand best channels to drive more conversions.
Yes you can use CID as a user ID but I haven't tried it with offline tracking. Share the result with us.

Can I track Adwords banner click from the other website?

I have an Adwords campaign, it sends users to Website-1.
And there is Website-2 and I want to track whether users that came to Website-2 have ever clicked on Adwords banner leading to Website-1 or not.
I could have set third-party cookies on Website-1 corresponding user is from Adwords and then get this info on Website-2. The problem is I don't have access to Website-1.
Is there any way to gain this info? I do have access to Adwords campaign, it's Google Account, Google Analytics on Website-2, it's Google Account and Website-2 itself. In other words, I have access to everything except Website-1
You might use third-party redirect/counter, for example different ad-serving tool like AdForm, where you should be able to generate unique redirect URL in bulk for your campaign.
Disadvantages:
you loose gclid information on AdWords tracking (because of redirect) and you need to use manual UTM tagging
You need to pay ad-serving fee (few bucks for thousands of visitors) and someone to set it up
You would only know if that someone clicked AdWords Ad, not really visited (beacuse you would count before that someone landed)
In conclusion: don't do it if you don't have direct access to GA of website-1
Yes you can do this in a pretty simple way, just set up Cross Domain tracking as described here:
https://support.google.com/analytics/answer/1034342?hl=en
This will save original source information (including AdWords) wen user goes from Website-1 to Website-2. On Website-1 you need to edit Analytics code (on all pages) and add so called autoLink:
ga('create', 'UA-XXXXXXX-Y', 'auto', {'allowLinker': true});
ga('require', 'linker');
ga('linker:autoLink', ['example-2.com'] );
Make sure that on both websites youre using newest version of Google Analytics: Universal Analytics, because this will not work in older version

Google Analytics sandbox

I have some problems with the google analytics not working on production, I have made some fixes and used some plugins to check that the information sent to google is ok, but the problem is I cannot test properly on my sandbox since I do not have the credentials for the analytics account used on production instance. I will not have access to that account and I do not want to create a dummy account linked to my sandbox because I cannot have my sandbox address indexed by google. Is there any way to install a local server that emulates GA? Or a way to create a GA account and prevent it from indexing my sandbox address? I have found the urchin software that would have given me the possibility to install a local sandbox, but this was discontinued by google and I was not able to find it anywhere.
If by "indexing" you mean "becoming a part of the Google search index an appearing in result pages", that is not in any way related to analytics. If you have a problem that your pages Urls show up in GA (which really is the whole point of Analytics) you can programmatically pass dummy urls to the tracker:
ga('send', {
'hitType': 'pageview',
'page': '/home' // pass a virtual adress here per page
});
That way your sites structure will not be recognizable in GA (however this will make testing more difficult).
If at all possible you should have Google Tag Manager installed on the live page. GTM has a preview mode that allows you to directly in the live site without affecting other users (tags are only visible to visitors with the preview cookie).
As for emulating locally, no, not really. If you still use asynchronous tracking (ga.js) you can use setlocalGifPath and _setLocalServerMode to have the tracking data send to your own server, but that will not give you the interface - it just means you can create a log file with the google parameters that you have to parse yourself.
Universal Analytics does not (to my knowledge) have corresponding methods (they are a remnant from urchin days when people wanted to reprocess their data locally. As you've said urchin is now defunct and it would have been too expensive for a bit of local testing in any case).

Change Google Analytics' uniqueness criteria

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

Google event tracking (background events)

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 :)

Resources