Server Integration With Google Analytics

Server Integration With Google Analytics

In this tutorial, I will mention step by step process to implement integration with Google Analytics or any google product through APIs.

In this example, I will specifically integrate Google Analytics with NodeJS.

Prerequisite Setup

  1. Should have Google Analytics account
  2. Should be added to any website to track some data and get them in APIs.

See my previous post Adding Google Analytics To Your Website to setup everything if not done yet.

Steps to create a server key from Google

  1. Go to Console Cloud
  2. Create a new project.
  3. Enable Google Analytics Reporting API for this project specifically.
  4. Once reporting API is enabled, create a new server key under credentails
  5. Download this server key in JSON format file. This file looks like this.

  6. The last step is to create a user on Analytics with server key information. Under your Admin > your property > User Management, create a new user with client_email mentioned in server key.

Once all steps are done, you are ready to implement your integration.

NodeJS Example Code for integration

Request Composer

There is a good way to create and test your request before implementing it in your actual code by using Request Composer provided by Google. You can create your actual request APIs specific to your business here and see your response results as well.

In case of any questions/concerns, please feel free to leave a comment below.

Happy Coding ;)

Adding Google Analytics To Your Website

Display Page Views On Your Pages - Google Analytics

Lakshay Katney Avatar

Lakshay Katney

Saleforce developer by profession but I like to work with various technologies.I blog about Force.com, Hybrid Apps, PhoneGap, AngularJS, BackboneJS, JavaScript in general. I am Angular & NodeJS fan.

Read More
Share this page
Latest 15 Posts

100%