Introduction
GrowthBook is an open-source platform to help companies make data-driven product decisions with feature flags and A/B tests.
MoEngage <> Growthbook
The MoEngage and Growthbook integration allows you to conduct multiple A/B experimentations using feature flags on your app or website and track their performance via MoEngage Event Tracking on Growthbook.
Integration
library_add_check |
Prerequisites
|
Tracking your Growthbook experiments on MoEngage
In order to successfully run experiments and track them on MoEngage, you need to call MoEngage SDK's track_event()
function inside Growthbook SDK's trackingCallback
function:
const gb = new GrowthBook({
apiHost: "https://cdn.growthbook.io",
clientKey: "sdk-abc123",
trackingCallback: (experiment, result) => {
// MoEngage SDK tracking
Moengage.track_event("GROWTHBOOK_EXPERIMENT_VIEWED", {
"experiment_id": experiment.key,
"variation_id": result.key
});
},
});
Growthbook offers SDKs for iOS, Android, Web, and more. You can read more about how to track events on multiple platforms here. In all the platforms, you need to call the appropriate Event Tracking method from the corresponding MoEngage SDK inside the callback method provided by Growthbook.
Once you have set up this tracking, you should see these events in your MoEngage Dashboard after you run an experiment.
Setting up MoEngage as a Data Source on Growthbook
In order for Growthbook to view your experiments' performances, you need to export the events from MoEngage to your data warehouse. MoEngage currently supports exports to Redshift and BigQuery.
MoEngage <> Growthbook via BigQuery
Follow our guide on BigQuery Exports to set up the exports for your MoEngage App. On the App marketplace, make sure to select GROWTHBOOK_EXPERIMENT_VIEWED
as one of the events to export.
- Once data starts flowing into your BigQuery database, head over to Growthbook >> Metrics and Data (side menu) >> Data Sources.
- Click on "+ Add Data Source".
- Select "Use Custom Source" from the list of Event Sources.
Field | Description | Value to be chosen |
---|---|---|
Data Source Type | Select "BigQuery" as your Data Source Type. | BigQuery |
Display Name | Give this source an identifiable name. | MoEngage |
Description | You can leave this blank. |
To understand how to fill in the other values and what permissions to give Growthbook, read their docs.
- Click "Save" once you have entered all the information.
- Select your identifier type as
user_id
if you want to track registered users on MoEngage. - Under "Experiment Assignment Queries", click on Edit option from the actions menu of "Logged-in Users":
- From the popup, click on the "Customise SQL" button.
- Replace the SQL with the following:
SELECT event.uid as user_id, event.event_time as timestamp, event.event_attributes.experiment_id as experiment_id, event.event_attributes.variation_id as variation_id FROM `<your-dataset>`.`<your-schema>`.`<your-table-name>` WHERE event.event_name = "GROWTHBOOK_EXPERIMENT_VIEWED"
Remember to update<your-dataset>
,<your-schema>
and<your-table-name>
with the actual names that you used to set up BigQuery Exports on MoEngage. - You can test your query to see a preview of the users who were involved in your experiment.
- Once satisfied with the results, click Save to save this custom SQL query.
- Click Save again to save the Experiment Assignment Query for Logged-in Users.
MoEngage <> Growthbook via Redshift
Follow our guide on Redshift Exports to set up the exports for your MoEngage App. On the App marketplace, make sure to select GROWTHBOOK_EXPERIMENT_VIEWED
as one of the events to export.
- Once data starts flowing into your Redshift database, head over to Growthbook >> Metrics and Data (side menu) >> Data Sources.
- Click on "+ Add Data Source".
- Select "Use Custom Source" from the list of Event Sources.
Field | Description | Value to be chosen |
---|---|---|
Data Source Type | Select "Redshift" as your Data Source Type. | Redshift |
Display Name | Give this source an identifiable name. | MoEngage |
Description | You can leave this blank. |
To understand how to fill in the other values and what permissions to give Growthbook, read their docs.
- Click "Save" once you have entered all the information.
- Select your identifier type as
user_id
if you want to track registered users on MoEngage. - Under "Experiment Assignment Queries", click on Edit option from the actions menu of "Logged-in Users":
- From the popup, click on the "Customise SQL" button.
- Replace the SQL with the following:
SELECT uid as user_id, event_time as timestamp, event_attributes.experiment_id as experiment_id, event_attributes.variation_id as variation_id FROM <your-schema>.<your-table-name> WHERE event_name = 'GROWTHBOOK_EXPERIMENT_VIEWED'
Remember to update<your-schema>
and<your-table-name>
with the actual names that you used to set up Redshift Exports on MoEngage. - You can test your query to see a preview of the users who were involved in your experiment.
- Once satisfied with the results, click Save to save this custom SQL query.
- Click Save again to save the Experiment Assignment Query for Logged-in Users.
You are now ready to track your users and perform experiments in your app or website. You can create various metrics on Growthbook and track them. Use the above SQL query template as a base to write other queries on top of your BigQuery or Redshift table as per your requirements.