Google Analytics
The Google Analytics connector enables you to fetch analytics data for a website or app connected to Google Analytics. Use the Google Analytics connector to automate fetching reports, properties, and run real-time reports.
Prerequisites
To use the Google Analytics connector, you first need to connect your Google Analytics account using the following steps:
- Log in to your Contentstack account.
- After logging in, click the App Switcher icon, then select Agent OS from the list.Click to enlarge
- Click + New Project or select an existing one.
- In the top navigation panel, click Automations.
- Click Configure Action Step in the left navigation panel and then Action Step to configure third-party services.
- Within the Choose Connector, click the Google Analytics connector.Click to enlarge
- Under Choose an Action, select any action (for example, Get Property).
- In the Configure Action section, click + Add New Account to add your Google Analytics account.
- Complete the Google sign-in flow and grant Contentstack access to see and download your Google Analytics data.
This sets up your Google Analytics account for the Google Analytics connector.
Set Up the Google Analytics Connector
Perform the following steps to set up the Google Analytics connector:
- From the left navigation panel, click Configure Action Step.
- Then, click Action Step to configure third-party services.
- Within the Choose Connector, click the Google Analytics connector.
- Under Choose an Action, you will see the four actions described below:
Get Property
The Get Property action retrieves details for a specific GA4 property. To use the Get Property action, follow the steps below:
- Under Choose an Action tab, select the Get Property action.
- On the Get Property Configure Action page, enter the details given below:
- Click + Add New Account button to connect your Google Analytics account as shown in the Prerequisites step.
- Select or enter the GA4 property ID in the Select Property field.Click to enlarge
- Click Proceed.
- Check if the details are correct. If yes, then click Test Action.
- You will get the response(s). Once set, click Save and Exit.
List Properties
The List Properties action lists all GA4 properties you can access. To use the List Properties action, follow the steps below:
- Under Choose an Action tab, select the List Properties action.
- On the List Properties Configure Action page, enter the details given below:
- Click + Add New Account button to connect your Google Analytics account as shown in the Prerequisites step.
- Click the Show Optional Fields toggle button to use this optional field:
- Enter the Page Size to set the number of items per page (default: 200, max: 200).Click to enlarge
- Enter the Page Size to set the number of items per page (default: 200, max: 200).
- Click Proceed.
- Check if the details are correct. If yes, then click Test Action.
- You will get the response(s). Once set, click Save and Exit.
Run Real-time Report
The Run Real-time Report action retrieves real-time analytics data for your GA4 property, including current active users. To use the Run Real-time Report action, follow the steps below:
- Under Choose an Action tab, select the Run Real-time Report action.
- On the Run Real-time Report Configure Action page, enter the details given below:
- Click + Add New Account button to connect your Google Analytics account as shown in the Prerequisites step.
- Select or enter the GA4 property ID in the Select Property field.
- Click the Show Optional Fields toggle button to use these optional fields:
- Enter comma-separated Dimensions, for example country, city, deviceCategory (up to 9 dimensions).
- Enter the comma-separated Metrics, for example activeUsers, screenPageViews. Defaults to activeUsers.
- Enter the Row Limit to set the maximum rows to return. The default is 10,000.Click to enlarge
- Click Proceed.
- Check if the details are correct. If yes, then click Test Action.
- You will get the response(s). Once set, click Save and Exit.
Run Report
The Run Report action retrieves analytics data from a GA4 property with selectable dimensions, metrics, and date ranges. To use the Run Report action, follow the steps below:
- Under Choose an Action tab, select the Run Report action.
- On the Run Report Configure Action page, enter the details given below:
- Click + Add New Account button to connect your Google Analytics account as shown in the Prerequisites step.
- Select or enter the GA4 property ID in the Select Property field.
- Enter the Start Date in YYYY-MM-DD format or a relative date like today, 7daysAgo, or 30daysAgo.
- Enter the End Date in YYYY-MM-DD format or a relative date like today or yesterday.
- Enter the comma-separated Metrics, for example activeUsers, screenPageViews. Defaults to activeUsers.
- Click the Show Optional Fields toggle button to use this optional field:
- Enter the Row Limit to set the maximum rows to return. The default is 10,000.Click to enlarge
- Enter the Row Limit to set the maximum rows to return. The default is 10,000.
- Click Proceed.
- Check if the details are correct. If yes, then click Test Action.
- You will get the response(s). Once set, click Save and Exit.
This completes the Google Analytics connector's setup.