How to send 'custom variables' parameters in Measurement Protocol(GA)? - javascript

I'm develop on a html5 project. The project is an news reading html5 site. It has offline reading feature, now we need to integration the Google analzyer to get the user access report.
But we found the GA js sdk do not support offline function.
Then I try to get more information on the GA help site. I found the Measurement Protocol can help to do this.
It's said we can send the GA request through the API. But I stop again on the develop process, because we need to send custom variables like JS SDK:
_gaq.push(['_setCustomVar', 1, 'user-online', 1, 1]);
I've checked on the GA help site but not any informations about the "Custom Variables".
I think this article should be of help but there are no more detail sample code to explain the parameters.

Universal Analytics (UA) is what the Measurement Protocol drives. They've changed quite a few things. Not sure about the accuracy of the other elements of this article, but it is correct about the fact that Custom Dimensions have replaced Custom Variables in UA https://www.optimizesmart.com/beginners-guide-to-universal-analytics-creating-custom-dimensions-metrics/
Head here to read about Custom Dimensions https://developers.google.com/analytics/devguides/collection/protocol/v1/parameters#cd_

Did you read this? https://developers.google.com/analytics/devguides/collection/gajs/methods/gaJSApiBasicConfiguration#_gat.GA_Tracker_._setCustomVar
It's name, value and scope, identical to the old analytics

Related

set cookie on the chrome extensions (chrome://extensions) for google analytics

I'm new to chrome extension development. we've needed to trace our customers for out service growth. so we've been wanting to get the metric for retention of our users. but there were some wired thing that same number of users each user type was traced. I attached it below. this is Google Analytics Cohort Analysis of our service.
a screenshot on the google analytics
but I think Event metrics(Behavior > Events) are being collected correctly. screenshot is here.
Google Analytics > Behavior > Events
so I looked for Google Analytics users. and I've figured out that Google’s tracking snippet looks for a tracking cookie on user's device. site address is here. https://www.hotjar.com/google-analytics/glossary/users/
according to these documents, Google uses cookie to distinguish user type between new users and returning user. so I've set the checkProtocolTask option to false into GTM console like this. cuz chrome extension doesn't have http or https protocols.
Google Tag Manager Console
but user cohort is still weird. I really wanna get correct result of new users cohort analysis.
question
why google analytics shows us weird cohort result?
what can I do for this more?
my english ability is not good and I don't know Google Analytics well so my questions are kind of a mess. please understand me 🙏
thanks for reading this question!
Ok, so for Extension tracking, I have never heard of people using GTM for extension tracking. That doesn't sound correct to me. Just because of how GTM deploys analytics, expecting there to be a standard window scope, relying on all the standard window.location values and many other properties and like the resolution, viewport, "this" and such.
Moreover, since you're a JS developer and you're not going to delegate tracking to non-JS devs, you probably want to use GA's measurement protocol directly rather than completely relying on the default library through GTM.
With the measurement protocol, you will be able to explicitly set all the fields you're interested in, including client IDs. You will have to manage user cookies on your side, but it's easier than trying to force web tracking logic to work for extensions.
Here is the parameter reference. It may be very useful to you: https://developers.google.com/analytics/devguides/collection/protocol/v1/parameters
And here is an npm lib that implements measurement protocol. I use it with Node, but it can definitely be used on the front-end too: https://www.npmjs.com/package/universal-analytics
I actually tried quite a bit of npm packages for measurement protocol usage and I found this one the most comfortable for me. There's a lot of them. Feel free to browse.

Where can I find more info on DFP tags and parameters

This page : https://support.google.com/dfp_sb/answer/1068325?hl=en does not cover all available optional and required parameters.
More specifically I want to know what the following are used for :
ged
eid
sdr
The Google documentation does cover the ad-request parameters that the publisher (website) can append and that DFP will interpret and act on.
However, the video ad-request is made by the video player via the IMA SDK, which appends its own parameters, e.g. ged as discussed on the IMA SDK google group.
https://groups.google.com/forum/#!topic/ima-sdk/D2kxzDg93bQ
I suppose that you and I cannot or should not use those parameters and therefore Google does not document them.
Having said that, the Google techies do seem willing to provide some information via the google group - which may be the best place to get more information if you feel you need it.
These are parameters used for things like engagement tracking (ged=), which tracks whether the user is engaged with the page based on signals like scroll events, etc. They are added to the request by the player specific SDK (Flash, HTML5, etc).
These parameters are not included in the official documentation unfortunately, and are not found in the SDK docs.
https://support.google.com/dfp_premium/answer/1068325?hl=en

Google Analytics - how to track across domains when we use Universal Analytics and other domain uses Traditional?

We're trying to track users across domains from our site to another domain (payment processor). We are using Universal Analytics (analytics.js) but the other site is using Traditional (ga.js). In fact they are using both, but they are using ga.js to register our GA ID and universal to track their GA ID.
If both parties were using Universal Analytics then it could be accomplished by appending a _ga=$_gaCookieValue url parameter to all links pointing from our site to theirs. Since they are using ga.js for our GA Id this url parameter is not getting picked up and registered on their site.
Does anyone know how we might solve this mismatch? We're pressing the other site for help but have come up short so far.
ga.js does not support this type of communication with analytics.js, so what you're asking to do is just not possible without a lot of hacking or manual implementation on their part, which would be a total waste of time since it'll be much easier for them to just upgrade their implementation to analytics.js and then use the officially supported Linker plugin to get out of-the-box, cross-domain tracking.

Facebook conversion pixel and google tag manager

I am not an engineer but im asking question beyond my understanding. The company i work for recently reported that the Google Analytics often gave us wrong statistics. When i tried to scrawl the website's HTML code , I found that the facebook conversion pixel code was put ahead of the google tag manager code on our website. Does that affect how google analytics work ? In my mind, google analytics suggests us not to put other tracking code to interfere GA.
While it defeats the purpose of tag management systems to have tags outside the tag management container Google Analytics will work just fine with other tracking pixels, and Google certainly does not say anywhere that you should not use other tracking software. Nobody would use GA if it interfered with the normal operations of a website.
So no, the Facebook Pixel will not interfere with GA. You can easily check if the data is transmitted correctly if you use the Chrome extensions that Google provides - look for "Google Tag Assistant", that's the most userfriendly option. Install it via the Google Play Store, it will add a small icon to the right of your adress bar, and if you click the icon you can enable it for any given domain. It will display an error via a red icon if something is wrong, and will give some detailled information about what is being sent to the Google Analytics tracking server. That might help you to find the actual error if there is a problem with data collection (it will not help you to find configuration problems).

Google Analytics: Do I need URL address?

I am a complete Google Analytics beginner and would appreciate a help with a basic question.
I am developing HTML, CSS and JavaScript based applications which are further uploaded into an iOS application to present your applications in a fancy way. Therefore my application is a hybrid application (half JS web site, half mobile app).
I would love to see users' activity in my app when they are browsing through it and I thought GA might work well with it - but the problem is, that the outer app doesn't provide me with any URL of my inner JS app (the inner web site's URL is file:///).
At this page (link), I found that URL is not really important, that it is the tracking code which is important. So I used a dummy URL, added the GA snippet into my application and uploaded it in iPresent. I can't see no live activity though... :/ It also says the measuring is not installed (not used at a home page).
So I am wondering - is the URL really important?
Any ideas?
Thanks!
URL (or page path) is only important if you want to report on data based on which URLs your visitors went to.
If you app doesn't use URLs at all, perhaps it fits better with the "app" model where you are sending screen name data instead of page data. You can read more about the differences between web and app views here:
https://support.google.com/analytics/answer/2649553
I found out that URL is not needed. This type of problem can be solved by using GA Measurement Tool
https://developers.google.com/analytics/devguides/collection/protocol/v1/
Validate your hit here:
https://ga-dev-tools.appspot.com/hit-builder/

Categories

Resources