google-analytics-api

Get Source and Medium from ga.js

半城伤御伤魂 提交于 2019-12-23 22:51:40
问题 I have a newsletter page on my website which I'd like to also use to capture some additional information about the user using Google Analytics. Using the getAll() method from ga.js I can get the referrer URL (if any), however I cannot see the medium or source data. Is this possible to retrieve using their ga.js library? 回答1: Retrieve specific tracker from the list of trackers you obtained. Use the following to access the fields source and medium. tracker.get('campaignSource') and tracker.get(

Google Analytics - How to get the client_id (anonymous client id) sent with Measurement Protocol

天涯浪子 提交于 2019-12-23 20:50:16
问题 we are seding requests like this throught the google analytics measurement protocol to track user interaction there. For us its important to be to link a interaction to a specific user so we where happy to be able to set the "cid" attribute of the protocol. my problem is that I cannot find this Client ID somewhere inside the reports of google analytics. Even when customizing the reports I cannot find a Dimension which allows me to display this information. http://www.google-analytics.com

Set API key with embed API google analytics

可紊 提交于 2019-12-23 17:12:42
问题 I was rending map with my google analytics data using embed api as: (function(w,d,s,g,js,fs){ g=w.gapi||(w.gapi={});g.analytics={q:[],ready:function(f){this.q.push(f);}}; js=d.createElement(s);fs=d.getElementsByTagName(s)[0]; js.src='https://apis.google.com/js/platform.js'; fs.parentNode.insertBefore(js,fs);js.onload=function(){g.load('analytics');}; }(window,document,'script')); gapi.analytics.auth.authorize({ serverAuth: { access_token: 'my access token' } )}; var commonConfig2 = { query: {

Google Analytics reports API - Insufficient Permission 403

扶醉桌前 提交于 2019-12-23 17:07:20
问题 I am trying to access data from google-analytics. I am following the guide and is able to gauthorize my user and get the code from oauth. When I try to access data from GA I only get 403 Insufficient Permission back. Do I somehow have to connect my project in Google API console to my analytics project? How would I do this? Or is there some other reason why I get 403 Insufficient Permission back? I am doing this in Python with Django and I have Analytics API turned on i my API console! 回答1:

invalid_client: The OAuth client was not found. Python

守給你的承諾、 提交于 2019-12-23 17:03:26
问题 I have an old project, that is trying to retrieve data from google analytics. It is not working, so I am trying to figure out what's wrong. Found an example code to work with Analytics on server side. scope = ['https://www.googleapis.com/auth/analytics.readonly'] key_file_location = 'secrets.json' credentials = ServiceAccountCredentials.from_json_keyfile_name(key_file_location, scopes=scope) http = credentials.authorize(httplib2.Http()) service = build('analytics', 'v3', http=http) accounts =

Google Charts Embed API is not working

只谈情不闲聊 提交于 2019-12-23 15:44:44
问题 I'm using Embed API to include GA charts on my site from ServiceAccount. The site is a Single Page application with AngularJS. I've created several directives for every chart type and a controller, name it GAController , shared between them. In this controller i use gapi.analytics.ready(..) to wait until analytics object is fully loaded. The problem is that when GAController is called for first time after page refresh, then gapi.analytics.ready(..) is called with callback function and then

Correlating certain metrics with Sessions and Products in Google Analytics API v4

╄→尐↘猪︶ㄣ 提交于 2019-12-23 13:09:20
问题 I have a requirement in the GA api to get a few very specific types of metrics: Site Level Site Visits with a Cart Add: This is a count of how many sessions occurred for a time frame where a cart add occurred in the session. Site Visits with a Product View: This is a count of how many sessions occurred for a time frame where a product detail view occurred in the session. Product Level Product Visits: This is how many sessions occurred from the scope of a product. For example, sku 12345 had

Using GoogleApisClient ServiceAccountCredential calling RequestAccessTokenAsync throws Exception

与世无争的帅哥 提交于 2019-12-23 09:38:25
问题 Background: I have set up a Service Account for my project on Google Developer Console and using the Service Account Email, the Certificate and the secret password and following the example provide in the GoogleAPisSample Plus.ServiceAccount. The snippet below is part of my Windows Service application: var List<string> Scopes = new List<string> { "https://www.googleapis.com/auth/analytics.readonly" }; var credential = new ServiceAccountCredential( new ServiceAccountCredential.Initializer

Google Analytics API - Are multiple queries possible?

青春壹個敷衍的年華 提交于 2019-12-23 05:36:11
问题 I would like to generate an API call that looks as follows: var dataChart5 = new gapi.analytics.googleCharts.DataChart({ query: [ { metrics: 'ga:totalEvents', dimensions: 'ga:date', 'start-date': beginDate, 'end-date': endDate, filters: 'ga:eventAction==Search;ga:eventCategory==Company' }, { metrics: 'ga:totalEvents', dimensions: 'ga:date', 'start-date': beginDate, 'end-date': endDate, filters: 'ga:eventAction==Search;ga:eventCategory==Accommodation' } ], chart: { container: 'chart5-container

Fatal error: Class 'Google_Auth_AssertionCredentials' not found

别说谁变了你拦得住时间么 提交于 2019-12-23 04:45:29
问题 I'm trying to migrate the old google api to the new one, so I can get the google analytics data. I'm trying with this example, but it fires this error Fatal error: Class 'Google_Auth_AssertionCredentials' not found in example.php This is how I'm trying: ini_set('display_errors', 1); ini_set('display_startup_errors', 1); error_reporting(E_ALL); require_once 'google-api-php-client/vendor/autoload.php'; //$p12FilePath = '/path/to/key.p12'; $serviceClientId = '395545742105.apps.googleusercontent