Universal Analytics - Track demographic data on server side - google-analytics

I am using Staccato gem to fire pageview events from server side.
While on client side enabling demographic data tracking is easily added by using
ga('require', 'displayfeatures');
How can I add similar support to server side tracking?

Well, do you really need it? Demographics is collecting info about the user by Google already knowing stuff about the visitor. If I visit your site, Google get a page view for this, and Google know that it's me because of cookies and session data. It will know my gender, age and interests from Google+, Youtube and such (Only Google know for sure).
Even if you know something about the user on the server side, I'm having a hard time believing that you could transfer that knowledge to Google. If you say that this user is example#gmail.com on Youtube, Google has no way of knowing if this is true.
If you have gender and age info, you could upload this with the measurement protocol though.

Related

Trying to figure out why Google Analyics report more users than our own stack

Comparison is between the Google Analytics script and a "chat widget" loaded in a iframe on the onload event. The iframe is not loaded if the useragentlooks like a crawler. The code in the iframe creates a websocket connection and then a user is upserted in our backend.
I'm looking at one website where we currently get around 2/3 of new users reported by Google Analytics as users in our backend.
With the new Google Analytics UI, it's not clear to me how much crawlers are actually filtered or not (e.g. is Google Analytics always filtering Google Crawler?). That could explain a lot.
Our "tracking id" is saved in localstorage which is a bit more persistent than a cookie, but I can't see it making a big difference.
The extra loading time and the websocket connection can probably explain a bit (old browsers that don't support TLS 1.2, baldy configured proxies, etc) can explain some of it, but 1/3 seems big.
Any insights in Google Analytics metrics or other ideas are welcome.
Bot traffic in Google Analytics is not filtered by default. You can enable it in View Settings.
Also it's possible to pass User Agent strings into Google Analytics as a custom dimension and then create filter to exclude sessions based on User Agents that you know to be bots.
https://www.lunametrics.com/blog/2015/04/01/eliminating-bot-traffic-from-google-analytics-once-and-for-all/
The second reason of difference may be that GA tracker fires when page starts to load, but "chat widget" when window is loaded. Some bounced sessions (and users) are counted by GA, but not counted by "chat widget".

Can I use a GCLID to generate a page view as if it came from the original owner of that GCLID

I've been looking into offline tracking of google analytics goals. I want to implement this in a similar way to how call tracking companies do and I'm guessing the GCLID is the answer.
If I store the GCLID of every visitor that comes to our website in the database alongside some info about their session and then identify their session at a later date as one that produced an offline goal, can I then generate a goal from that?
My thinking is that if I had a button in our CRM system that when I click it opens up an invisible iframe that links to mysite.com/goalurl.html?gclid=xxx then analytics on that page would track a goal on that page but attribute it to the original click that the other user made on our PPC advert. Theoretically I could do this 10 times in a row for 10 different sessions and they would all be tracked as if the 10 original owners of those GCLIDs has visited the goal page, right?
Am i missing something here? Would this not work because Google would spot that they all came from the same IP address, or because I would have the same GA cookie on my machine? Or does Gogole not care about any of that?
Any help would really be appreciated.
I am not sure if it works with the gclid but would also be interested in the answer.
Besides that, a possible solution is to store the Analytics client ID in your own database and, whenever there is a conversion, sending that conversion data (referencing the recorded client ID) directly from your server to Analytics by using the Measurement Protocol.
Exactly this topic is a case study in the book "Google Analytics Breakthrough: From Zero to Business Impact".

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.

Tracking a clients QR Codes - Google Analytics

We would like to track clicks on QR codes on behalf of a client - they have their own analytics account - but we would like to track the clicks to determine whether a QR code is required on future campaigns.
We initially thought that we would provide a url to a page on our server which would track the click and re-direct to the relevant link - but we have also read about urchin tracking modules and wondered whether these could be used in this scenario instead as a less labour intensive method? Does anyone have any experience with this - if so could you advise on best practice?
Can anybody
You can track that by using a relatively new feature in Google Analytics: the measurement protocol. It allows you to send data straight to GA via HTTP requests.

Combining Google Analytics client- and server side tracking

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.

Resources