Google Analytics
The Google Analytics module XXXX.
Table of contents
Drupal projects discussed in this chapter: Charts, Google Analytics, Google Analytics Reports.
Introduction
Get analytics code.Installing and enabling the modules
- Install and enable as you would normally install and enable a contributed Drupal module.
Configuration
Google Analytics
Google Analytics Reports
The project depends Views project. access google analytics reports
- Google Analytics Reports - Display statistics from Google Analytics using Views and Charts.
- Google Analytics Reports API - provide an API to GA data.
Install Charts module and enable the Google Charts submodule for dispalying charts. For better page loading with reports blocks is recommended to install and setup Ajaxblocks module.
To access data from Google Analytics you have to use project in Google Developers Console. You may use an existing or create a new.
The Google Developers Console UI has been updated since the
projects README.txt
(re: this issue at Drupal.org). Here are updated instructions.
Before you can get the credentials you may need to create a new project and enable the analytics API for it:
- Open Google Developers Console. Log in to you Google account if required.
- This will take you to a screen to manage your Google analytics APIs. In the top bar there will be a menu to select an API project (if you have one), and to create a new project. Click on the down-triangle of the menu.
- This will produce a modal pop-up. To create a new project, click on the plus (+) sign.
- Give the project a name and press “Create”.
- Make this the active project.
- Use the hamburger menu to select Filter on “Analytics”. Select “Analytics API”
- Press “Enable”,
Then get the credentials:
- Use the hamburger menu to select .
- Click the pull-down menu “Create credentials”. Select “Help me choose”.
- Under “What API are you using”, select “Analytics API”. (If this option does not appear, you have not yet enabled this API for this project, see steps 6 and 7 above).
- Under “Where will you be calling the API from?” select “Web Browser (Javascript)”. Under “What data will you be accessing?”, select “User Data”.
- Press “What credentials do I need?” and edit the name if necessary.
- Leave empty “Authorized JavaScript origins”.
- Fill in “Authorized redirect URIs” with “
https://example.com/admin/config/system/google-analytics-reports-api
”. Replace “example.com
” with the base URL of your site. - Press “Create Client ID”-button.
- Type a product name to show to users and hit “Continue” and then “Done”.
- Use the hamburger menu to select .
- Click on the name of your new client ID to be shown both the “Client ID” and “Client Secret”.
Final word
[TBA]
Last update: 2015-05-14 for D7 [gh].