analytics.js

Analytics.js callback executed before library is loaded

老子叫甜甜 提交于 2020-05-17 07:08:06
问题 I'm facing a very weird issue with analytics.js. Basically, I have a basic implementation at the top of the page, and inside another JS file that is loaded right after the analytics.js is downloaded and initialized I have a function that validates if ga has been enabled loaded. In that function I get the ga function in a local variable named gaFn , and I use the callback function of the analytics library to make sure the analytics library has been loaded to use the tracker, my problem is that

analytics.js event not working properly

為{幸葍}努か 提交于 2020-01-03 03:57:10
问题 I implemented analytics.js (new version) in my ASPX webapplication. I got pageview working just fine, but events is very often not being send. In my example, I tried pushing 3 different buttons, but only one of them fired the event. I added an alert-box to each event, to verify that it actually is fired, and these all show. This is my js, placed just before the </head> (function(i, s, o, g, r, a, m) { i['GoogleAnalyticsObject'] = r; i[r] = i[r] || function() { (i[r].q = i[r].q || []).push

what are the values in _ga cookie?

时光总嘲笑我的痴心妄想 提交于 2019-12-28 07:39:04
问题 I am using universal analytics. universal analytics creates first party cookie _ga _ga=1.2.286403989.1366364567; 286403989 is clientId 1366364567 is timestamp what is 1 and 2 in _ga cookie? 回答1: _ga=1.2.286403989.1366364567; 1st Field This is a versioning number. In case the cookie format changes in the future. Seems to be fixed at 1 at the moment. The one above is an old format. Newer cookies have this value set at "GA1" 2nd Field This field is used to figure out the correct cookie in case

Google Universal Analytics Localhost Setup

时间秒杀一切 提交于 2019-12-12 08:31:45
问题 I'm trying to test GA on localhost after following the suggestions in Can you test google analytics on a localhost address? 1). but I don't see any data being send to my Google Analytics account when browsing on my localhost server and calling the JS script. I know it's executing the JS. What am I doing wrong? Here is my JS code: (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){ (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o), m=s

Is it OK (in google analytics) o have some pages with the GTM and others with analytics.js?

六月ゝ 毕业季﹏ 提交于 2019-12-12 02:46:21
问题 Per my answer here I have some pages using Google Tag Manager to report Google Analytics and some that report them directly using Analytics.js. It seems to be working OK but I wanted to see if there were any issues I should be aware of. 回答1: You would need to make sure that whatever you are tracking with on-page code on those pages that don't have GTM are not already being tracked through GTM. Generally speaking, it's not advisable to mix both GA and GTM on the same site (unless you are in

Passing UTM Tags to Google Analytics with Google Tag Manager in Javascript not working

丶灬走出姿态 提交于 2019-12-11 14:40:06
问题 I'm trying to send utms (medium, source) to Google Analytics directly in Javascript code (not via the URL), for every visit to my page. This is how I'm trying to do it: <script async src="https://www.googletagmanager.com/gtag/js?id=UA-52626777-6"></script> <script> window.dataLayer = window.dataLayer || []; function gtag(){dataLayer.push(arguments);} gtag('js', new Date()); gtag('set', { 'campaignName':'MyCampaignName', 'campaignMedium':'MyMedium', 'campaignSource':'MySource' }); gtag('config

How to set up page speed logging for google analytics in analytics.js

这一生的挚爱 提交于 2019-12-08 23:39:33
问题 Google released the new Analytics.js (https://developers.google.com/analytics/devguides/collection/analyticsjs/). I would like to use it, and I already have everyting set up just fine, apart from site speed. In the "old" ga.js you could do this with _gaq.push(['_setSiteSpeedSampleRate', 50]); This would set it so 50% of the visitors would report sitespeed to analytics. However, for the new analytics.js I cannot get it to work. I tried the following 2: ga('send','setSiteSpeedSampleRate',50);

trackingId and clientId with Google tag manager

一笑奈何 提交于 2019-12-06 08:13:08
问题 Using analytics.js, i can access to trackingId or clientId with this functions: ga.getAll()[0].get('trackingId') ga.getAll()[0].get('clientId') With Google tag manager, there is no ga object. How i can get that parameters? 回答1: The tracking ID is input into GTM either through a constant string macro (for reusability), or just as a string. The client ID can be fetched through custom Javascript (from the blog I am about to mention): function() { try { var tracker = ga.getAll()[0]; return

Send file download event from server to Google Analytics [duplicate]

☆樱花仙子☆ 提交于 2019-12-06 05:10:52
问题 This question already has an answer here : How can I track downloads of files from remote websites (1 answer) Closed 2 years ago . A download link is sent to a customer via email : Hello, Please find your product here: https://www.example.com/files/yourfile.zip I'd like to track this download in Google Analytics, as a Goal conversion. Unfortunately, when the user clicks on the link, the file is directly delivered by the web server , without going trough a .html page. How to track such a

trackingId and clientId with Google tag manager

时光毁灭记忆、已成空白 提交于 2019-12-04 12:15:02
Using analytics.js, i can access to trackingId or clientId with this functions: ga.getAll()[0].get('trackingId') ga.getAll()[0].get('clientId') With Google tag manager, there is no ga object. How i can get that parameters? The tracking ID is input into GTM either through a constant string macro (for reusability), or just as a string. The client ID can be fetched through custom Javascript (from the blog I am about to mention): function() { try { var tracker = ga.getAll()[0]; return tracker.get('clientId'); } catch(e) { console.log("Error fetching clientId"); return "n/a"; } } See this blog: