google-analytics-api

Authentication for Google API

流过昼夜 提交于 2019-12-11 13:14:46
问题 I'm trying to understand the flow how to authenticate user on WEB client (JS), and then use Google API on my back-end server (ASP.NET MVC application), on behalf of authenticated user for retrieving users contacts list. Here the current flow that I use: 1.In HTML I use google JS client: https://apis.google.com/js/client.js: function auth(callback) { var config = { 'client_id': '***********', 'scope': 'https://www.googleapis.com/auth/contacts.readonly' }; config.immediate = true; gapi.auth

How can I combine/speed up multiple API calls to improve performance?

一个人想着一个人 提交于 2019-12-11 12:42:10
问题 Update: I found something that might be useful, but I'm still having a bit of trouble figuring out how to implement it. If I try to map the get_data like so, I'm not sure how I can assign the results of each call to the respective variable. parameters = [ [service, profile_id, '30daysAgo', 'ga:browser', 'sessions::condition::ga:deviceCategory==desktop'], [service, profile_id, '60daysAgo', 'ga:browser', 'sessions::condition::ga:deviceCategory==desktop'], ... [service, profile_id, '90daysAgo',

Google API Refresh Token

我与影子孤独终老i 提交于 2019-12-11 12:05:17
问题 I have been trying for the last few hours to print my refresh_token from the initial Google API call (even after de-authorizing and re-authorizing as others have suggested doing) but I still am not having any luck...the API works as expected but I want to set up refreshing functionality so my user does not lose access after token expires (resulting in errors). Currently, the below code sets $_SESSION['refresh_token'] to null. Any help would be greatly appreciated as I have been banging my

GoogleAnalyticsR api - FilterExpression

耗尽温柔 提交于 2019-12-11 11:24:57
问题 I need to retrieve data from google analytics using R I write the following code with GoogleAnalyticsR: df <- google_analytics(viewId = my_id, date_range=c(start,end), metrics = c("pageViews"), dimensions = "pagePath", anti_sample = TRUE, filtersExpression ="ga:pagePath==RisultatoRicerca?nomeCasa", max=100000) I need to set correctly the FiltersExpression parameters. I 'd like to have data from pagePath that contains RisultatoRicerca?nomeCasa. This code returns me a dataframe with 0 rows,

Display Google Analytics Data in View

折月煮酒 提交于 2019-12-11 10:26:54
问题 I'm working on a Google Analytics Client for an MVC application that collects data from Analytics API and I'm trying display the data in a view. The ultimate goal is to display the Google Analytics Data with Google Charts. However I'm not sure how to properly structure the Data. Each metric is a dictionary with a KeyValuePair where metric name is key and value is the actual value. For example ga:visitors, 3000 . I need to organize each metric with its KeyValuePair in to a dictionary that I

Embed API Third Party Visualizations

China☆狼群 提交于 2019-12-11 10:04:59
问题 I'm trying to run this script https://ga-dev-tools.appspot.com/embed-api/third-party-visualizations/ The problem is that when I enter the browser console gives me this error: Uncaught TypeError: Cannot set property 'innerHTML' of null so I thought enough to add <div id="view-name"></div> in the code and in fact part of the script, but with a horrible graphics. That does not fully reflect the real one. The script is used in this way: {literal} <script> (function(w,d,s,g,js,fs){ g=w.gapi||(w

Google Analytics V3 - How to create custom segments for API Service Accounts

六月ゝ 毕业季﹏ 提交于 2019-12-11 09:42:58
问题 I need to access custom segments in Google Analytics via reporting the API. There is no trouble with it, except that custom segments are not shareable across multiple profiles/users set in Google Analytics, so a segment has to be created for each profile. And in the case of using a Service Account generated through Google API's Console, segments have to be created for that account – how do I log in to Google Analytics with a Service account having Client ID, email address and public key

How to correctly integrate google API with React

淺唱寂寞╮ 提交于 2019-12-11 09:29:28
问题 I've integrated the Google analytics Embed API with my React app and I'm able to render correctly a graph. This is my container, which renders a line chart through the component UsersChart : class StatsContainer extends Component { constructor(props) { super(props); initAnalyticsAPI(); } render() { return ( <Query query={GET_ACCESS_TOKEN}> {({ loading: loadingToken, error: errorToken, data: { getAnalyticsAccessToken } }) => ( <Query query={GET_BASIC_STATS}> {({ loading: loadingStats, error:

Google Analytics - invalid_grant: Invalid JWT Signature

邮差的信 提交于 2019-12-11 09:09:34
问题 I need to authorize from Google analytics to get the response data. var google = require('googleapis'), q = require('q'), SERVICE_ACCOUNT_EMAIL = '838823084353-cjjoiv9di67fuh7geqgggociibataf9v@developer.gserviceaccount.com', SERVICE_ACCOUNT_KEY_FILE = __dirname + '/google-services-private-key.pem'; var def = q.defer(); var gAnalytics = google.analytics('v3'); var authClient = new google.auth.JWT( SERVICE_ACCOUNT_EMAIL, SERVICE_ACCOUNT_KEY_FILE, null, ['https://www.googleapis.com/auth

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