Manage Google Analytics from Google Sheets using App Scripts written in TypeScript and deployed with Clasp.
GAsat is a collection of scripts built over the years for managing Google Analytics. It is built as a stand alone Google Sheets plugin that can be deployed as needed.
The current focus of the project is to add common filters and configurations that follow latest best practices. Pull requests are welcome just be nice and add an issue for any new work.
-
Clone repo
-
Install Clasp
-
Create a Google Sheet for the project. Name it anything you'd like.
-
Enable Apps Script API
-
Add a
.clasp.json
file to thesrc
folderFile format:
{"scriptId":"xxxxxx"}
Locate the Script ID in Sheets script editor (
Tools -> Script editor
) under the File menu (File -> Project properties
) -
Run
clasp login
from thesrc
folder -
Run
clasp push
from thesrc
folder to deploy code to Sheets -
Refresh (or open) the Sheet created in step 2
-
Run
Setup Sheets
from new Google Analytics menu that appears after Sheets loads -
Add target Google Analytics settings to the Settings sheet
-
Run commands from
Google Analytics
menu -
Confirm settings in Google Analytics
- Valid hostname Filter
- Lowercase URI Filter
- Lowercase Filter for ‘Campaign Name’, ‘Campaign Source’, ‘Campaign Medium’, ‘Campaign Term’ and ‘Campaign Content’
- Internal IP Addresses Filter
- Referral Spam Filter - (Using the Matomo blacklist and an additional custom list)
- HubSpot by ISP Organization Filter
- HubSpot app and sandbox domains Filter
- Add HubSpot tracking params to Exclude URL Query Parameters View Settings
- Add Facebook fbclid param to Exclude URL Query Parameters View Settings
- Add additional Exclude URL Query Parameters from sheet
- Added amazonaws.com ISP Domain filter