• This repository has been archived on 30/Jul/2022
  • Stars
    star
    224
  • Rank 177,792 (Top 4 %)
  • Language
    Python
  • License
    Other
  • Created over 11 years ago
  • Updated over 7 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Publicly share your Google Analytics reporting data.

Google Analytics superProxy

The Google Analytics superProxy allows you to publicly share your Google Analytics reporting data. Use it to power your own custom dashboards and widgets, transform responses to various formats, manage your quota efficiently, test, and more. It handles authentication, caching, and response-formatting for you.

It works with the following Google Analytics APIs: Core Reporting API, Real Time Reporting API, and Multi-Channel Funnels Reporting API

Quick Links

Feature Highlights

  • Public access to your Google Analytics data
  • Use the proxy to power your own custom dashboards
  • Convert to CSV, Data Table, TSV
  • Relative dates are supported (e.g. last 7 days)
  • Automatically refreshes report data
  • Caching - fast responses and efficient quota usage

The Google Analytics superProxy is a web application that runs in the Google App Engine python environment.

Setting up a local development environment

  1. If necessary, download and install Python 2.7
  2. Download and install the App Engine SDK for Python
  3. Create an APIs Console Project.
  • Go to the Services pane to activate the Analytics API service.
    • Go to the API Access pane and create an OAuth 2.0 Client. For Client ID settings select Web Application. For the hostname click more options and then add the following to the Authorized Redirect URIs field: http://localhost:8080/admin/auth. Note: you may use a different port, but you need to use that port consistently throughout your project. Click on Create client ID.
  1. Edit config.py in the Google Analytics superProxy src directory. Update OAUTH_CLIENT_ID, OAUTH_CLIENT_SECRET, and OAUTH_REDIRECT_URI with the corresponding values from the OAuth 2.0 Client you created in the previous step. The redirect URI does not need to include /admin/auth, this will be added for you.
  2. (Optional): The default the timezone for resolving relative dates is the Pacific timezone. The default setting for "anonymizing" Core Reporting API responses is set to False. Both of these options can be configured in src/controllers/util/co.py.
  3. Add the Google Analytics superProxy app to the Google App Engine Launcher (File->Add Existing Application) or start the app using dev_appserver.py. For additional details see The Development Environment. Make sure to serve the application using the same port as set in the list of Authorized Redirect URIs for your APIs Console Project, and in config.py.
  4. View the app by visiting http://localhost:8080/admin (replace 8080 with the correct port number).

Hosting the application on App Engine

  1. Setup the local development environment as described above.
  2. Register an application ID for your application using the App Engine Administration Console. This will give you a free hostname on appspot.com.
  3. Edit the app.yaml file in the src directory of the Google Analytics superProxy and set the first line to the application ID you registered in the previous step. E.g. application: your-application-id.
  4. Edit or create a new APIs Console Project and add the full URL of your application + /admin/auth as an Authorized Redirect URI for the OAuth 2.0 Client. If using the free appspot.com domain, the redirect URI will look something like https://your-applciation-id.appspot.com/admin/auth.
  5. Edit config.py in the Google Analytics superProxy src directory and update OAUTH_CLIENT_ID, OAUTH_CLIENT_SECRET, and OAUTH_REDIRECT_URI if necessary.
  6. Using the Google App Engine Launcher or appcfg.py deploy the application. For details see Uploading Your Application.
  7. View the app by visiting the /admin page of your application. E.g. https://your-application-id.appspot.com/admin.

Creating your first public query

  1. See instructions above to get up and running, either with a local dev environment or on App Engine.
  2. View the application by visiting the /admin page. E.g. https://your-application-id.appspot.com/admin.
  3. Follow the instructions to authenticate and authorize the application to access your Google Analytics account.
  4. Create a new query (a Core Reporting API query URI) and specify:
  5. Click Save & Schedule Query to save the query and start scheduling the query for automatic refresh. A new Public Request Endpoint (URL) will be created for this report.

Requests to the public endpoint URL will return the API response for the specific report created. Authorization will not be required to access the report data and it will automatically refresh.

Features

  • OAuth 2.0 for authentication and it's all handled for you server side
  • Multiple users - each with their own set of queries
  • Automatic scheduling to refresh data at a configurable time interval
  • Caching of responses (saves on quota and it's fast)
  • API Query stats (last request time and number public requests)
  • Transform responses to CSV, Data Table, or TSV.
  • Relative dates are supported for reporting queries (e.g. last 7 days).
  • Timezone for relative dates can be configured (North American timezones and UTC).
  • Auto-scheduling. Scheduling for an "abandoned" API query (i.e. hasn't been publicly requested for a long time) will be automatically paused, resuming only if is subsequently requested.
  • Responses can "anonymized". If enabled, then Google Analytics profile IDs and other account information is removed from the public response.
  • Error logging. Errors for scheduled API queries are logged. After an API Query (default) has 10 error responses, scheduling for the query is paused.
    • The Google Analytics superProxy will not publicly return error responses. Instead the last successful response will be returned.
  • Public endpoints can be enabled/disabled if you want to stop sharing.
  • Queries can be be refreshed on an adhoc basis instead of waiting for the next scheduled refresh.
  • JSONP (add a callback parameter to the Public Endpoint request URL).

Changelog

2013-07-19

  • Initial launch...super sweet!

2013-08-06

  • Multiple Google Charts on a single page works again! (Fixes Issue #3)
  • Added a sample Google Charts HTML/JS demo.

More Repositories

1

autotrack

Automatic and enhanced Google Analytics tracking for common user interactions on the web.
JavaScript
4,925
star
2

ga-dev-tools

A showcase of demos and tools built with the various Google Analytics APIs and Libraries.
TypeScript
1,389
star
3

google-analytics-plugin-for-unity

Google Analytics plugin for the Unity game creation system
C#
388
star
4

ga4-tutorials

HTML
91
star
5

bigquery-export-ipython-notebooks

70
star
6

hello-world-android-app

Java
48
star
7

javascript-api-utils

JavaScript
44
star
8

gav4-python

A library for converting Google Analytics Core Reporting API V3 request to Analytics Reporting API V4 requests.
Python
39
star
9

gtm-consent-mode-examples

Google Tag Manager Consent Mode Examples
Smarty
35
star
10

google-analytics-magic-script

JavaScript
32
star
11

cute-pets-example-android-app

Java
29
star
12

analytics-samples-config

Google Analytics Sample Code for Configuration APIs
JavaScript
27
star
13

hello-world-ios-app

Objective-C
20
star
14

legacy-samples

Legacy samples migrated from code.google.com
HTML
17
star
15

google-tag-manager-ios-sdk

Swift
12
star
16

cute-pets-example-ios-app

Objective-C
12
star
17

ecommerce-migration-helper

JavaScript
12
star
18

python-docs-samples

Python
12
star
19

analytics-data-javascript-examples

10
star
20

dotnet-docs-samples

C#
9
star
21

analytics-data-curl-examples

Shell
9
star
22

nodejs-analyticsadmin

Google Analytics Admin API client library source for Node.js.
JavaScript
7
star
23

AppsFlyerWrapperAndroid

Java
6
star
24

firebase-analytics-cordova

A cordova plugin that provides Firebase Analytics to Cordova apps
Java
4
star
25

AdjustWrapperAndroid

Java
3
star
26

AppsFlyerWrapperIOS

Helper library to easily send information to both the AppsFlyer and Google Analytics for Firebase backends.
Objective-C
3
star
27

php-docs-samples

PHP
3
star
28

java-docs-samples

Java
3
star
29

typo3-gtag-integration

PHP
2
star
30

AdjustWrapperIOS

Objective-C
2
star
31

.github

1
star
32

.allstar

1
star
33

nodejs-docs-samples

JavaScript
1
star