google-analytics

Unable to create custom page tracking URL for external links with Universal Analytics Code

自古美人都是妖i 提交于 2019-12-11 08:39:55
问题 I'm using the following Universal Analytics code on all of the pages on my site: <script> (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.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m) })(window,document,'script','//www.google-analytics.com/analytics.js','ga'); ga('create', 'UA-XXXXXX-XX', 'mydomain.edu'); ga('send', 'pageview'); </script> On some of the

Google analytics inside shadow DOM doesn't work

泪湿孤枕 提交于 2019-12-11 08:36:40
问题 In my chrome extension instead of using any html pages, shadow DOM is being added from the background js pages. It seems like no events are being pushed for analytics. After adding the extension as shadow root the structure looks as follows Now the chrome extension manifest.json looks like "manifest_version": 2, "content_security_policy": "script-src 'self' https://ssl.google-analytics.com; object-src 'self'", "background": { "scripts": ["js/background.js"], "persistent": true }, and few

How to solve “illegal character” error when saving Google Script for Google Analytics

倾然丶 夕夏残阳落幕 提交于 2019-12-11 08:36:02
问题 I'm working on automating Google analytics to get results into a google drive dashboard and coming up with an error code in "illegal character. (line 7, file "code")" How do i fix this problem? Here is the full script. I appreciate the help in advance. Thanks. // Get Data. var results = Analytics.Data.Ga.get( tableId, startDate, endDate, 'ga:visitors,ga:visits,ga:pageviews', {‘dimensions’: ‘ga:date’}); // Output to spreadsheet. var sheet = SpreadsheetApp.getActiveSpreadsheet().insertSheet();

google analytics differences between dashboard and API

喜夏-厌秋 提交于 2019-12-11 08:18:42
问题 I get different numbers when I use google analytics APIs compare to google analytics dashboard. I use the exact same filters in both ways. 回答1: In a word: Sampling Regardless of how your traffic data is collected (sampled or unsampled), Analytics may examine only a portion of the collected data when calculating the result for a report. This type of sampling is called report sampling. It occurs automatically when you query for data that is not available in aggregate. Google Docs on Sampling

Trigger javascript function depending on PHP condition

谁说胖子不能爱 提交于 2019-12-11 08:14:01
问题 I have a form that will return values in its URL, including whether the form is valid or not /contact2.php?result=contact-error-captcha&name=John /contact2.php?result=contact-ok&name=John I am trying to trigger a Google Analytics Pageview depending on this value, which normally works in javascript like this: onclick="ga('send', 'pageview', '/mypage');" Here is my last attempt, but it seems to not execute. <script type="text/javascript"> function error-captcha() { alert("Hello! This works");

Google Analytics reports 10 times lesser sessions than hits in server logs

百般思念 提交于 2019-12-11 07:30:16
问题 Let's say I've a page mysite.com/mypage Landing Page Report in GA for this URL for a specified duration, gives me a number of sessions - say 50. For the same duration, I checked Apache's access.log, and did a grep "GET /mypage , and I've got around 10x more hits -- say 500. How can we have a 10x anomaly between GA & Server Logs? Where did the hits go? This anomaly is present for other durations too. I've compared various durations. Before someone tells the standard reasons for this, let me

How to track UTM data in Squarespace form submissions

喜夏-厌秋 提交于 2019-12-11 07:28:35
问题 I've seen a lot of questions about the easiest way to change the value of a parameter, but nothing about how to change the parameter itself. For example: example.com/?utm_campaign=1&utm_source=2 would become: example.com/?SQF_CAMPAIGN=1&SQF_SOURCE=2 I've tried modifying this previous solution but I don't really understand how it works: <script> var url = $('.mylink').attr('href') url = url.replace('utm_', 'sqf_') $('.mylink').attr('href', url) </script> If you're curious about why I'm doing

Cannot find AdSense Analytics code

為{幸葍}努か 提交于 2019-12-11 07:24:35
问题 It seems that after Analytics got their latest face-lift the AdSense / Analytics connection got a bit left behind. According to the documentation I need to add the AdSense Analytics code to my page. I already have the regular Analytics code and it's working fine. According to Google help the code should be in the Edit AdSense linking settings link at the top of your account's Overview page. But it isn't. There isn't even an Analytics Settings link in the upper corner, just Settings and that

Google analytics event tracking on Multiple accounts not working

我只是一个虾纸丫 提交于 2019-12-11 07:22:31
问题 I have multiple accounts on some pages - I am trying to track some events - they fire beautifully when I test them on Fiddler - but they are not coming into my analytics - the code is below - what am I doing wrong? Three days later any help would be GREAT. <script type="text/javascript"> var _gaq = _gaq || []; _gaq.push( //tracking for first ['_setAccount', 'UA-XXXXXX-1'], ['_trackPageview'], //tracking for second ['b._setAccount', 'UA-XXXXXX-16'], ['b._trackPageview'], ['b._trackEvent'], ['b

Google Analytics: Track two domains as one

本秂侑毒 提交于 2019-12-11 07:22:29
问题 At work we have two domains that serve the exact same website/code/etc. I'm trying to find out if there is a way to track them through Google Analytics and have a single account that could not care less which domain it's serving analytics data for? The issue that I have currently is that the domain that we use for advertising is showing up as a referrer which is hiding (or at least I don't know how to find) what the true source was (google/bing/yahoo/etc). Please note... After searching on