Change log

Set Up Analytics

Treepl CMS allows you to integrate Google Analytics views into the Admin Dashboard. This guide will help you configure your Google Analytics and your Treepl CMS site, so that the data is pulled from Google Analytics into the Admin area.

Requirements

In order to configure the integration you, or your client, will need to have:

  • A Google Account and valid Google Analytics property set up for the site
  • A website instance on Treepl CMS

Configuring the Google Analytics dashboard will automatically add Google's tracking code to the included Google Tag Manager script output to your site. So you do not need to manually add the tracking code yourself. However, if you would like to add your own Google Tag Manager script you can do so as described further below.

Google Analytics API Project

To create a Google API project visit https://console.cloud.google.com/projectcreate

Set a name for your project.
Depending on your account, you may also be asked to assign a 'Billing account'.
'Organization' and 'Location' can be left as the default in most cases.
Click 'Create'.

Project name

Once created you should see a notification popup with the new project listed.
Click on this project to further configure it.
In the absence of the notification link, you can navigate to the project using the project name dropdown at the top of the screen.
Once inside the project, click on the "Go to APIs overview" link.

API Overview

Click "Enable APIs and Services" at the top of the screen.

Enable APIs and Services

In the search field, type 'Analytics' to filter the list of APIs available.
You should see results for both "Google Analytics Reporting API" and "Analytics API".
We'll need to enable both of these, however we'll start with the "Google Analytics Reporting API" so click on that item.

Search Analytics APIs

Click "Enable".

Enable Google Analytics Reporting API

Once enabled, you should be brought to that APIs page where you can click "Create Credentials".

Create Credentials

Here we can skip straight to creating a "service account" by clicking on that link.

Create Service Account

Clicking on the three dot menu at the top right of the screen, choose "Create Service Account".

Create Service Account

Provide a Service account name and description then click "Create".

Provide Name and Description

Open the 'Select a role' dropdown and scroll down the left side list of items until you reach "Roles".
Hover/click on "Roles" and choose "Role Viewer" from the corresponding right side list.

Role Viewer

Click "Continue".

Continue

Click "Done".

Done

Click the 3 dot icon next to the created account and choose "Create Key" from the options.

Create Key

Leave "JSON" key type selected and click "Create".
Your Key will be generated and will either save to your downloads folder on your computer or you'll be asked where you'd like to save it (depending on your browser settings).
You'll need this file to upload to your Treepl CMS admin later, so keep it handy and file it in a safe place.

Generate and download key

Close the confirmation dialog.

Close confirmation

You should be returned to the Service Accounts screen where your new key is listed with a long email address (1).
Copy this email address now as you'll use it in the following steps when configuring your Google Analytics property.

Now, while here we'll click back to the Dashboard page (2) to enable the second API required.

Service account email

Click "Go to APIs overview" link.

API Overview

Click "Enable APIs and Services" at the top of the screen.

Enable APIs and Services

Again, search for 'Analytics' to filter the list of APIs available.
This time click on "Google Analytics API".

Analytics API

Click "Enable" and we are now done configuring the required APIs.
You can close out of the Google APIs page and continue to configuring your Google Analytics property with the following instructions.

Enable Google Analytics API

Google Analytics configuration

This step requires that you, or your client, have a valid Google Analytics account set up. A free account can be created here if needed.

Log into your Google Analytics account https://analytics.google.com/.

If you are using an existing Google Analytics account that has not been upgraded to the new GA4 version, click the “Legacy GA Accounts” tab for legacy instruction.

If you are setting up a new Google Analytics account, or are using an existing account already on version GA4, click the “GA4 Accounts” tab for updated instructions.

Legacy GA Accounts

Select the appropriate 'Analytics Account' and navigate across to the appropriate 'View' set up for your property.

Account Property View

Click "Admin" and navigate across to "User Management" under the 'View' column.

View User Management

Click the "+" button at the top right of the screen to add a new permission.

Add Permissions

Insert previously copied Service Account email, ensure 'Read and Analyze' permission is checked and then click "Add".

Read and Analyze Permission

Go to 'View Settings' and copy the "View id" and paste it to a blank text document, or somewhere temporary. You'll need this shortly.

be sure to copy and paste the ID only as sometimes an extra blank space may also copy across, stoping the integration from working.

View Settings
View ID

Go to 'Property Settings' and copy the "Tracking id".

again, be sure to copy and paste the ID only without any trailing spaces.

Property Settings
Tracking ID
GA4 Accounts

Set up a new Google Analytics account (or access an existing one).

Google Analytics Account Setup

If creating a new account, click the “Show Advanced Options” link during step 2 “Property setup” and turn on the ‘Universal Analytics property’ setting.

Turn on Universal Analytics property

Finish creating the account as per your requirements and navigate to the property dashboard. Expand the property name dropdown and you should now see two properties available for the same account (one for the new GA4 and one for the UA, or Universal Analytics). Select the UA property.

Access Universal Analytics property

Click on the "Property User Management" menu.

Property User Management

The User Management overlay should open automatically. From here, click the "+" button at the top right of the screen to add a new permission.

Add Permissions

Insert the previously copied Service Account email (from the above API setup), ensure 'Read and Analyze' permission is checked and then click "Add".

Read and Analyze Permission

Now back in the property dashboard, go to 'View Settings' and copy the "View id" and paste it to a blank text document, or somewhere temporary. You'll need this shortly.

be sure to copy and paste the ID only as sometimes an extra blank space may also copy across, stoping the integration from working.

Click the back arrow to go back to the full dashboard view.

View Settings and View ID

Now go to 'Property Settings' and copy the "Tracking id".

again, be sure to copy and paste the ID only without any trailing spaces.

Property Settings and Tracking ID

Now you can proceed to the following section for setting up the Analytics dashboard in Treepl CMS

Set up Analytics in Treepl CMS

Go to Treepl admin -> Settings -> Setup Analytics and complete the form with the previously copied values:

  1. Tracking Id (not required *)
  2. View Id
  3. Service Account Key File

Your Service Account file may not display in the upload field, or show after saving, however it will still upload and be applied.

If you make any changes to this page you must also upload the Service Account file again.

Troubleshooting Analytics Setup

Typically, the Analytics Dashboard in your Treepl CMS admin will not start display data straight away. It may take several hours for it to display and/or show any activity, showing some errors similar to "Data column(s) for axis #0 cannot be of type string". Allow 24hrs for the data to display.

If after this time you are still not seeing any activity reported, or are seeing other errors, try re-adding the Tracking and View IDs (ensuring no trailing spaces have copied over) and re-upload the Service key file. Then re-save the settings to apply the changes.

If you make any changes to this page you must also upload the Service Account file again.

Additionally, some browser extensions/plug-ins such as Ad Blockers or security tools may stop the dashboard from working correctly. Try disabling any ad-blockers or security related extensions in your browser to test for this scenario.

Google Tag Manager

When adding your Google Analytics Tracking ID to the Analytics setup, Treepl CMS will automatically add the Google tracking script to the included Google Tag Manager script output to your site.

You do not need to manually add the tracking code yourself. However, if you'd prefer to add the tracking code yourself, or need to add a customised version of it, you can simply omit the Tracking ID from the Treepl CMS Analytics setup. The Analytics Dashboard will still display data so long as you've correctly added your custom Tracking code to your site.



External Resources

There are currently no external resources available.

Please let us know if you have any other contributions or know of any helpful resources you'd like to see added here.


Questions?

We are always happy to help with any questions you may have.
Visit the Treepl Forum for community support and to search previously asked questions or send us a message at support@treepl.co and we will consult you as soon as possible.