Salesforce Google Analytics Integration

A Little Background About This Post:

In my recent project with one of my client , they came up with salesforce to Google Analytics integration as their challenge as  they were interested to see all page stats in salesforce itself .
I worked over this piece of integration and thought of sharing this with community .

Here we go for step by step guide .

Part 1: Create an oAuth ID (Other)
  1. Go to:
  2. Create a new project
  3. Enable the “Analytics API”New project creation
Go to credentials
  1. Create “oAuth Client ID”
  2. Configure (Other) and save
  3. Give it a name
  4. Save the client ID and client secret
  5. Download the JSON

Part 2: Compile the following URI call from the JSON
·         YOUR_REDIRECT_URI_HERE: Site which need to be tracked.
Call the above URI.

Part 3: If done right… you will get this screen. Answer ALLOW! 

Google will then issue you with this token – it may only be used once.

Get Access Token

With the following parameters:
  • Content-Type: application/x-www-form-urlencoded
  • grant_type: authorization_code
  • code:<CODE> (Code generated in previous step)
  • client_id: YOUR CLIENT ID from setup
  • client_secret: YOUR CLIENT SECRET from setup
  • redirect_uri: <URL to track>
    "access_token": "<Access Token>",
    "expires_in": 3600,
    "token_type": "Bearer"

After login get url similar to below
where IDs is in the red after letter ‘p’. Which is used in next step
JS Code from tracking Info section need to be pasted in website which need to be tracked.
  (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),

  ga('create', 'UA-101670932-1', 'auto');
  ga('send', 'pageview');


Part 6: Use the access_token to access any Google Analytics API URI


  1. It's so nice article thank you for sharing a valuable content. google cloud online course

  2. The website is looking bit flashy and it catches the visitors eyes. Design is pretty simple and a good user friendly interface.

    jogos friv gratis 2019
    Jogos 2019
    jogos friv


Post a Comment

Popular posts from this blog

A Quick Salesforce OAuth 2.0 Usage Demonstration

Salesforce To Authorize.Net Integration

Salesforce Shopify Integration