-
Notifications
You must be signed in to change notification settings - Fork 1
Analytics Provider Setup
This guide details the steps to grant the correct permissions to your existing Firebase service account and configure the necessary data definitions to allow the server to sync analytics data.
Your Firebase project has an automatically generated service account. Your server uses this account to authenticate with Google services.
- Open your project's
.envfile. - Find the
FIREBASE_CLIENT_EMAILvariable. It will look like this:firebase-adminsdk-xxxxx@your-project-id.iam.gserviceaccount.com - Copy this full email address. This is the identity you need to grant permissions to.
Your server needs to know which Google Analytics property to read from.
- Open your project's
.envfile. - Find the
GOOGLE_ANALYTICS_PROPERTY_IDvariable. - Copy this ID. This is the property you need to grant access to.
- Navigate to your Google Analytics Dashboard.
- In the bottom-left corner, click Admin (the gear icon).
- look for the Property Details section in the Property column.
- Verify that the Property ID displayed at the top right of the newly opened page exactly match the value of
GOOGLE_ANALYTICS_PROPERTY_IDfrom your.envfile.- If it does not match, use the dropdown menu at the top of the page to select the correct property before proceeding.
- Once you are viewing the correct property, navigate back to the Admin main menu.
- In the "Property" column, click on Property Access Management.
- Click the blue
+button in the top right and select "Add users". - In the "Email address" field, paste the service account email you copied in Step 1.
- Under "Roles", select "Viewer".
- Click the "Add" button in the top right to save the changes.
The service account now has the necessary permissions to read analytics data.
For the dashboard to function correctly, you must explicitly tell Google Analytics to track several event parameters as custom dimensions. This is critical for both "Ranked Lists" (e.g., Most Viewed Headlines) and the "Onboarding Funnels". Without these, the API will return errors or incomplete data.
You will need to repeat the creation process for each of the dimensions listed below.
- Navigate to your Google Analytics Dashboard.
- In the bottom-left corner, click Admin (the gear icon).
- Click on Custom definitions in the "Data display" column.
- Click the blue Create custom dimensions button.
Fill in the form exactly as follows:
-
Dimension name:
contentId -
Scope:
Event -
Description:
The unique ID of the content item (e.g., headline). -
Event parameter:
contentId(This must match the key sent by the app exactly). Click Save.
Click Create custom dimensions again and fill in the form:
-
Dimension name:
step_index -
Scope:
Event -
Description:
The numerical index of a step in a multi-step flow (e.g., app tour). -
Event parameter:
step_indexClick Save.
Click Create custom dimensions again and fill in the form:
-
Dimension name:
step_name -
Scope:
Event -
Description:
The string name of a step in a multi-step flow (e.g., initial personalization). -
Event parameter:
step_nameClick Save.
Note: It may take 24-48 hours for data to start populating in these new dimensions for API queries.
For comprehensive details regarding licensing, including trial and commercial options for the entire toolkit, please refer to the toolkit organization page.