Socket
Socket
Sign inDemoInstall

github.com/mtlynch/google-analytics-v4-example

Package Overview
Dependencies
0
Alerts
File Explorer

Install Socket

Detect and block malicious and high-risk dependencies

Install

    github.com/mtlynch/google-analytics-v4-example


Version published

Readme

Source

google-analytics-v4-example

License

Overview

This is an example of a simple console application that pulls pageview data from Google Analytics.

Pre-requisites

Enabling Google Analytics Reporting API

To query Google Analytics data, you'll need to enable the Google Analytics Reporting API in your Google Cloud Platform project.

Creating a service account

  1. Create a service account in Google Cloud Platform console for your project.
  2. Assign the service account no permissions/roles.
  3. Click "Create Key" to create a private key and save it in JSON format.
  4. In Google Analytics, open Admin > View > View User Management and add the email address of the service account you just created (it will have an email like [name]@[project ID].iam.gserviceaccount.com.
  5. Grant the user only "Read & Analyze" permissions.

Finding your Google Analytics View ID

  1. In Google Analytics, open Admin > View > View Settings
  2. Save the View ID displayed

Usage

go run main.go -viewID 123456789 -keyFile google-analytics-viewer-key.json

FAQs

Last updated on 20 Jan 2020

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc