A Google Script / Google Sheets project to download/upload custom dimensions from/to the Google Analytics Management API.
-
Installation
- Copy the code in Code.gs file
- Create a new Google Sheet, with two tabs labeled
Settings
andData
- In the
Settings
tab, insert your GA Property ID (UA-123456-1
) in cellB2
and the GA Account ID (123456
) - Navigate to
Tools
>Script Editor
- Paste the code. Save.
- From the Script Editor, go to
Resources
>Advanced Google Services
, search for the Google Analytics API and enable it.
-
Usage
- A menu labeled
Custom Dimension Management
should be available upon opening the sheet - From the menu, select either
Download Custom Dimensions
orUpload Custom Dimensions
Download Custom Dimensions
will... download the custom dimension definition into theData
tabUpload Custom Dimensions
will upload (insert) the custom dimension definition in theData
tab up to the Google Analytics property ID defined in theSettings
tab- If the menu is not available, you can run the
getCustomDims()
orsetCustomDims()
functions directly from the Script Editor.
- A menu labeled
-
Pre-requisites:
- Google Analytics property
- Google Sheet with access granted to Google Analytics API
-
Reference:
- Google Analytics Management API (v3)
- Example Google Sheet
-
TODO:
- Add account/property selection dialog
- Option to prefill property with placeholder dimensions
- Option to update and not insert