Configuring Google Analytics Integration
Members of the Admin role can use the Google Setup gadget to configure a connection to Google Analytics to specify an Analytics profile to use with the Dashboard gadgets. To add Google Analytics or Google Tag Manager scripts to Page Templates, the script tag provided by Google must be added to the Template's Metadata->Additional Head Content.
Google Service Accounts
A Google service account allows an application developer to use OAuth2 to obtain and use information of a user who provides consent to their account. Information may include:
- Basic Profile Information
- Calendar Events
- Email Contacts
Percussion CM1 will require a user to register their own application by creating a service account for their instance of CM1.
How to configure New account on Google Analytics (Admin Role)
NOTE: The current version only supports Universal Analytics tags, not the new Version 4 (GA4) tags. If you are creating a new Analytics account to use with Percussion CMS, be sure to follow the steps below, as the default settings used by Google will not integrate with CMS at this time.
- Go to Google Analytics (https://analytics.google.com)
- Click Admin >Click on create Account> Provide account name (one account can have many sites). Select all check boxes under Account Data Sharing Settings, and click on 'Next' Button
- Create a new Property (website). Name it something related to the site name
- Important: Click "Show Advanced Options" above the Next button
- In advanced options, turn on the "Create a Universal Analytics property" switch
- Enter your website URL
- You can create both GA4 and UA properties, or the UA property alone; as long as you have a UA property, since that is required for the current Percussion CMS integration.
- Click Next, then answer questions about your business, click Create, and agree to Google's Terms
- A new "Measurement ID" will be generated, as well as the script tags that must be embedded for any page to be tracked by Google Analytics. If you created your property to use both GA4 and UA, the UA Tracking ID looks something like "UA-123456789-1"; that is the one you will need for CMS integration
How to set up a Service Account
In order to use Google Analytics with CM1’s dashboard, you must configure at least one Service Account.
- Log in to Google Developer Console via https://console.developers.google.com
- Click the Create Project button (if you do not already have one)
- Fill out all required information
- From the menu on the top left, select the 'API & Services'.
- Go to 'API Library' and select 'Google Analytics API' and click Enable API
- Go to 'API Library' and select 'Google Analytics Reporting API' and click Enable API
- Select 'Credentials' from the left side of the screen
- Create a new Service Account by clicking 'Create credentials -> Service account key'
- Select Service Account and click 'Create Key' button
- Save the prompted .json file onto your file system
- Add permissions to link your Service account to Google Analytics. Below are steps to add a user (https://support.google.com/analytics/answer/1009702?hl=en)
- Sign in to Google Analytics(https://analytics.google.com)
- Click Admin, and navigate to the desired account/property/view.
- In the Account, Property, or View column (depending upon whether you want to add Users at the account, property, or view level), click User Management.
- In the Account users list, click +, then click Add new users.
- Enter the service Account email which you created on Google Developer Console (like : xxxxx@xx.iam.gserviceaccount.com) and Grant Read & Analyze permission.
- Click Add
How to set up an API Key
In order to use google analytics with CM1’s dashboard, you must configure at least one service Account.
- Log in to Google Developer Console.
- Using the dropdown in the top left corner of your page, select your project.
- Fill out all required information.
- Select APIs & Auth > Credentials
- Create a new API key by clicking Create new Key.
- Select the Server key button in the displayed modal.
You can prevent requests from other clients such as a database or IP addresses to keep your requests sanitized.
Adding Google Analytics Reporting to your Site(s)
If you would like to receive constant updates on your website’s traffic through CM1, we recommend you configure the Google Setup Gadget and Traffic Gadget.
To setup a Google Setup Gadget:
- Navigate to the CM1 Dashboard
- Click Add Dashboard Gadgets under the finder.
- Click and drag Google Setup onto the dashboard under the gadget carousel.
- Click and drag Traffic onto the dashboard.
- Enter your Google Service Account Email into the Account Email input into the Google Setup Gadget.
- Using the file browser, locate your correct private key file. Note: Your key file must be a .json file provided by the Google Developer Console (not the same as the API Key)
- Click the Connect button to validate your credentials. You will see a message indicating whether the connection was successful
- If the connection succeeded, you can select Google Analytics Profiles. For each site:
- Select the Profile from the dropdown - there should be at least one available
- Enter the API Key you created
- When you've entered a profile for each Site, click the Save button
You can now use other tools that rely on the Google Analytics integration, such as the Traffic Gadget (monitors website traffic) and the What's Working Gadget (compares traffic to publish history) - see Site Analytics.
Removing Google Analytic Tracking
If you no longer want a given site to be be tracked in Google Analytics, in the Google Setup Gadget's section "Select a Google profile for each site" simply change the setting for your site back to "Select Google Analytics Profile". Google Analytics / Tag Manager scripts added to Additional Head Content in Pages or Templates need to be removed, followed by a Full Publish of the site.