Install clasp
$ npm install # clasp is included as a dev dependency
$ npm run clasp -- login
Create your App Script instance
$ npm run create
First push
$ npm run push
To develop this connector you need to follow a couple more steps. They are specifically required to run the automated tests.
First, follow all steps in Setting Up for Deployment. Then:
Create a GCP project
Follow the steps listed here: [https://cloud.google.com/resource-manager/docs/creating-managing-projects#creating_a_project]
Get the GCP Project number and ID
Follow the steps listed here: [https://cloud.google.com/resource-manager/docs/creating-managing-projects#identifying_projects]
Record the number and ID somewhere.
Use the GCP Project number in clasp
Run:
$ npm run clasp -- setting projectId <PROJECT_ID>
Setup OAuth for the GCP Project
Visit: https://console.cloud.google.com/apis/credentials/consent?project=<PROJECT_ID>
.
Set the Application Name to clasp project
. Fill out the required email fields, add your current account
as a test user, then click Save and continue
until the wizard completes (you don't need to add any scopes).
See instructions here: https://github.com/google/clasp/blob/master/docs/run.md#setup-instructions. Make sure
to run all clasp commands through npm, for example, instead of clasp setting ...
, npm run clasp -- setting ...
.
Set the GCP Project Number in apps script
Run:
$ npm run clasp -- open
Click Project Settings on the left.
Enter the GCP Project number in Google Cloud Platform (GCP) Project section and save.
Enable the Apps Script API
Go to: https://console.cloud.google.com/apis/dashboard?project=<PROJECT_ID>
Click Enable APIs & Services and search for Apps Script API.
Click the Apps Script API search result and enable the API.
Create OAuth credentials
Run:
$ npm run clasp -- open --creds
Click Create credentials > OAuth client ID.
Select Desktop App for the application type.
Enter clasp
for the name.
Click Create.
Download the client credentials and save it as creds.json in the root folder (it will be ignored via .gitignore).
Run:
$ npm run clasp -- login --creds creds.json
Now you'll be able to run the automated tests via npm test
.
Deploy a version
$ npm run clasp -- deploy # marks the current HEAD as a new version
$ npm run clasp -- deployments # prints out existing deployments
Push the current code for manual testing
$ npm run push
This command will build and push the code, then print out a link you can use to test the pushed code in Looker Studio.
The connector references several environment variables that can be used to alter its functionality slightly. These
variables are all listed in the root .env
file of this repository. Changing the values in this file before
building, pushing & deploying will make sure those values are used within the connector in Apps Script.
It is also possible to set these variables directly in the Apps Script settings page. This can be useful for temporary changes, for example, if you need to enable debug logging.
Values in Apps Script settings will always supercede values define in .env
files.
The connector functions by making API requests to your Matomo instance. Depending on how many people use the connector in conjunction with your Matomo instance, this could be a significant number of added load.
If this is a concern for you, the connector will send the fromLooker=1
query parameter in every API request it
makes. You can look for API requests with this parameter to see just how much of an effect the looker studio
connector is having.
Note: the name of the parameter (ie, fromLooker
) can be customized through changing the associated variable
in the root .env
file.