Register and setup the Analytics module
Register the Analytics module
Before you setup the Analytics module, you must register it in Google Analytics. You must register when you are setting up Analytics for the first time.
Perform the following:
Enable Google Analytics as a trusted location for Sitefinity CMS.
- In Sitefinity CMS backend, navigate to Administration » Settings » Advanced » WebSecurity » RefererValidation.
- In the Trusted locations input field, enter accounts.google.com and click Save changes.
Enable Google Analytics API and get the required data to integrate it into Sitefinity CMS.
- Navigate to Google Analytics and log in to your Google Analytics account.
- Navigate to Google Cloud Platform.
- In the toolbar, click Select a project.
The Select a project window appears.
- Click NEW PROJECT.
The New Project page appears.
- Choose a name for the project and click Create.
- In the toolbar, click on the Notification icon and then click on your newly created project.
- In the menu on the lift, click APIs & Services » Library.
- Under Other, select Google Analytics API.
- In the top part of the screen, click ENABLE.
- In the upper-right corner, click CREATE CREDENTIALS.
- In the Which API are you using dropdown, select Google Analytics API.
- Select User data.
- Click Next.
- Under OAuth Consent Screen, fill in the required fields, such as App name, User support email, and Developer contact information. Click SAVE AND CONTINUE.
For more information, see Google documentation about Authentication overview.
- Under Scopes, click SAVE AND CONTINUE.
- Under OAuth Client ID select Web application.
- Under Authorized redirect URIs, enter http://<your website>/Sitefinity/marketing/Analytics
- Click Create.
- Copy and save in a secure place the following information under Download your credentials:
- The Client ID
- To obtain the client secrets, click Download, open the saved JSON file, and copy the value of the
- Click Done.
RESULT: You have registered the Analytics module and you can continue to setup the Analytics module in Sitefinity CMS backend.
Set up the Analytics module
PREREQUISITES: Before you setup the Analytics module, you must have added the Google Analytics script on at least one page, and the module must have already collected some data.
When you open the Analytics module for the first time, you need to configure it to show data for the site you want.
To setup Analytics, perform the following:
- Login to the Sitefinity CMS backend and navigate to Marketing » Analytics.
If you have not used the Analytics module before, the Configure Analytics link appears.
- Click Configure Analytics.
- Paste the Client ID and Client Secret that you have copied in procedure Register the Analytics module » Step 20.
NOTE: For specific Client ID and Client Secret, Sitefinity CMS stores only the latest generated refresh token. The reason is Google OAuth 2.0 limitation of 50 refresh tokens per user account. For more information, see the Google documentation about OAuth 2.0 token expiration.
- Click Login to Google.
- Allow the created project to view and manage your Google Analytics data.
- The Select Google Analytics account page opens.
- In Available accounts, select the view that you have created to track this website.
NOTE: If you have not set the tracking code, provided by Google Analytics on any page of your website or the page where you have set it has not been requested, Sitefinity CMS cannot find account and your domain in the list of Tracked domains.
- In Tracked domains, select the domain of your website.
If you do not see the domain in the list, you can enter it manually.
- Click Save Settings.
The Google Analytics tracking code appears.
RECOMMENDATION: We recommend you use this code instead of the existing Google Analytics tracking script, because it enables tracking of site visitors consent on your sites. For more information, see Tracking consent.
- Click Go to Analytics.
RESULT: You can see website analytics data in the Analytics module.