...
In Source data URL provide customized Google Analytics REST API URL which returns the data (https://www.googleapis.com/analytics/v3/data/ga?ids=ga:XXXX&start-date=2016-10-01&end-date=2017-11-30&metrics=ga%3APageLoadTime&dimensions=ga%3Adate
). Change at least following URL parameters (corresponding to Google Analytics API Reference Guide):
...
Restrict requested data set by providing Scope value - https://www.googleapis.com/auth/analytics.readonly
Fill Authorize URL with "https://accounts.google.com/o/oauth2/auth?access_type=offline" (access_type=offline is a must to get refresh token from Google Analytics REST API) and Token URL with "https://accounts.google.com/o/oauth2/token"
Click Add custom JavaScript code to add custom JavaScript code that will process received data:
Code Block |
---|
function formatDate(s) { return s.substr(0,4)+'-'+s.substr(4,2)+'-'+s.substr(6,2); } return _.map(doc.rows, function(row) { var rowdoc = {}; for (var i = 0; i < doc.columnHeaders.length; i++) { var name = doc.columnHeaders[i].name.replace(/^ga:/, ''); rowdoc[name] = name == 'date' ? formatDate(row[i]) : row[i]; } rowdoc["Project"] = "Project 1"; return rowdoc; }); |
You can add own custom/calculated values, like in this example value for "Project" property.
...
Google Analytics source application definition example
If you would like to use this Google Analytics import example from this tutorial then you can use the following source application definition:
Expand | ||||
---|---|---|---|---|
| ||||
|