Questions tagged [google-analytics-api]

A set of APIs for building custom reporting solutions and programmatically managing existing Google Analytics accounts and users.

Google Analytics is a free data collection and analysis platform by Google. The Reporting and Management APIs are for developers already tracking data with the Google Analytics collection libraries. See also the google-analytics tag for general information.

The Reporting APIs

Save time by automating complex reporting tasks and integrate Google Analytics data with other data for deeper insights about your business with these Reporting APIs:

The Management API

Authorized users can programmatically access and manage Google Analytics accounts, users, and data with the Management API.

In addition to managing all account levels and users, you can also use this API to manage certain types of data, like upload cost data to Google Analytics for non-Google paid campaigns, retrieve account data to use with the Reporting APIs, and manage content experiments.

Demos & Tools

Developers to discover what's possible with the Google Analytics Platform. Explore what’s possible and learn how to build powerful and flexible applications with the Google Analytics Demos & Tools.

More links:

4319 questions
40
votes
3 answers

How to delete a event from event tracking of Google Analytics?

I send some event to Google Analytics using this function _gaq.push(['_trackEvent',category,action,label,value]); but I sent them just for testing my code and now I want to delete them and start real tracking. How can I delete them?should I use any…
pooya
  • 901
  • 2
  • 15
  • 29
37
votes
10 answers

Google Analytics 4 with React

I've been trying to use react-ga package with google analytics 4 in my app. The measurement id doesn't work with it and there is no tracking code in google analytics 4 I can use. Please, I need help! import ReactGA from 'react-ga'; const trackingId…
36
votes
6 answers

How to login to Google API with Service Account in C# - Invalid Credentials

I'm beating myself bloody trying to get a simple service acccount login to work in C#, to Google API and Google Analytics. My company is already getting data into Analytics, and I can query information with their Query Explorer, but getting started…
32
votes
11 answers

"Not sufficient permissions" google analytics API service account

I'm trying to fetch data with the Google Analytics API through service accounts. I have been searching on stackoverflow how to do this and been using the exact same code found on several posts but getting problems to get it…
Kozmk12
  • 545
  • 1
  • 5
  • 15
31
votes
5 answers

Is it possible to read ExperimentId and VariationId in Javascript with Google Optimize?

I have created an A/B-test using Google Optimize. Now I would like to read the current experimentId and variationId in Javascript. My goal is to run different javascript based on the given variation. I can't seem to find any info on this in the…
Øyvind Holmstad
  • 1,379
  • 2
  • 13
  • 22
31
votes
4 answers

Google Analytics API: filter by URI?

My site has user profiles that are accessible via URLs that look like this: www.domain.com/profile/123/.... I want to show users page view statistics of their profiles, but need to be able to do wildcards. For example, this…
StackOverflowNewbie
  • 39,403
  • 111
  • 277
  • 441
28
votes
5 answers

How to obtain Google service account access token javascript

I'm trying to set up an analytics dashboard of my site for my leadership to view site usage. I don't want them to have to have a google account or to add them individual to see the results. I've set up a service account and OAuth2 access. All the…
Rothrock
  • 1,413
  • 2
  • 16
  • 39
28
votes
5 answers

Display Google Analytics data on my web site?

I'm trying to figure out a way to display data collected from Google Analytics on my web site. I'm using NopCommerce, and I want to display this information/statistics in a view in the Admin Section. There might be many ways to achieve this, and…
28
votes
5 answers

OAuth 2.0 with Google Analytics API v3

I used to be able to query the Google Analytics API with my account's login & password. Google is now using OAuth for authentication which is great... The only issue is that I only need ONE access token. I don't wanna allow other users to fetch…
lpdahito
  • 556
  • 2
  • 10
  • 16
27
votes
4 answers

Scraping Real Time Visitors from Google Analytics

I have a lot of sites and want to build a dashboard showing the number of real time visitors on each of them on a single page. (would anyone else want this?) Right now the only way to view this information is to open a new tab for each site. Google…
26
votes
1 answer

How to read events from Google Analytics API?

How do I read custom events from the Google Analytics API (e.g. with the help of gapi.class.php)? If I have three events (myEvent1, myEvent2 and myEvent3) and they all belong to eventCategory myEventCategory, how do I read that data? I have been…
Christoffer
  • 25,035
  • 18
  • 53
  • 77
25
votes
2 answers

Query Google Analytics by User ID

Is there a way to query results using the Core Reporting API (v3) and filtering those results by the User ID assuming that it is being sent to Google Analytics properly? I've googled this question a lot and read a whole bunch of articles but I did…
Kassem
  • 8,116
  • 17
  • 75
  • 116
24
votes
3 answers

How to get Google Analytics credentials without gflags - using run_flow() instead?

This may take a second to explain so please bear with me: I'm working on a project for work that requires me to pull in google analytics data. I originally did this following this link, so after installing the API client pip install --upgrade…
20
votes
11 answers

R - Google Analytics Package

Is there an R package that connects to the Google Analytics API? Does anyone have any pointers otherwise?
Dan
  • 6,008
  • 7
  • 40
  • 41
19
votes
5 answers

Google Tag Manager with AngularJS?

How do I use GTM with Angular? I'm trying to fire a (virtual) pageview event when I load a new partial using this code: dataLayer.push({ 'event' : 'pageview', 'pageview' : $location.path(), 'virtualUrl' : $location.path() }); But I…