• 0
Sign in to follow this  
rschiefer

Google Analytics Datasource?

Question

1 answer to this question

Recommended Posts

  • 1

Hi,  You may be interested to know we have 2 Beta datasources

  • Google_Analytics_RealTime_Stats
  • Google_Analytics_PageStats
Which if you contact support can be imported into your account.
 
The need a  bit of set up

setup for Google Analytics Datasources: Step-by-step guide

(a)The following items must be included in the Device Properties
analytics.client.id
analytics.clientsecret.pass
analytics.refreshtoken.pass
system.categories -> GoogleAnalytics

(1) Follow these steps in order to get an Access Token and the Refresh Token.
On your browser, log-in at Google with the account you want to use to access Analytics info.

(2) Visit https://code.google.com/apis/console . Click on create a "project". Search for "Analytics API" and click 'Enable'. Afterwards, navigate to Credentials -> OAuth Consent Screen.
Choose the 'email address' and 'Product name shown to users' and save.

(3) Create Credentials -> OAuth Client ID.
Application Type: Other
Input any name (i.e. : LM Client ID)

(4)You should now be presented with a Client ID & Client Secret.

(5) Navigate to the following URL and insert the correct Client ID.
https://accounts.google.com/o/oauth2/auth?scope=https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fanalytics&redirect_uri=urn:ietf:wg:oauth:2.0:oob&response_type=code&client_id=INSERT_CLIENT_ID_HERE
You will be presented with a screen to allow access and code string you will need to copy and save.

(6) Go into a terminal and paste the following cURL command.
curl -H "Content-Type: application/x-www-form-urlencoded" -d 'code=INSERT_CODE_STRING_HERE&client_id=INSERT_CLIENT_ID_HERE&client_secret=INSERT_CLIENT_SECRET_HERE&redirect_uri=urn:ietf:wg:oauth:2.0:oob&grant_type=authorization_code' https://accounts.google.com/o/oauth2/token

(7)The output of the previous cURL command should be a JSON response similar to the following:
{code:json}
{
"access_token" : "ya29.AH3afsdfasdfjhahskjhskkskjh",
"token_type" : "Bearer",
"expires_in" : 3600,
"refresh_token" : "1/HH9E7dfdf4saf3wah7899a8sd989"
}
{code}

(8)You should now have the ClientID, Client Secret & Refresh Token. Insert these into the device properties to get the datasource properly working.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this