Setting up product analytics in BigQuery

Overview

This topic explains how to set up LaunchDarkly product analytics in BigQuery.

BigQuery is Google Cloud’s managed serverless enterprise data warehouse. It integrates with LaunchDarkly product analytics to provide a warehouse-native analytics solution that lets you visualize and analyze your data.

BigQuery does not support all product analytics features

Not all of the features available in LaunchDarkly product analytics are available in BigQuery. User activity, some trends features, and some funnel conversion criteria are not supported. To learn more, read Using product analytics charts.

Prerequisites

Before completing this procedure, you must have the following:

  • Access to a BigQuery data warehouse
  • The ability to create and modify new datasets in BigQuery
  • The ability to create new service accounts in BigQuery

Configure Google Cloud and BigQuery

In Google Cloud and BigQuery, create a new service account and give it the BigQuery Job User role:

  1. Navigate to IAM and Admin, then click Service Accounts. The “Service accounts” page appears.
  2. Click Create service account. The “Create service account” page appears.
  3. In the “Service account details” section, enter a Service account name. Optionally, enter a Description.
  4. Copy and save the Email ID for the service account. You will use it in the next procedure.
  5. Click Create and continue. The “Grant this service account access to project resource” menu opens.
  6. In the “Role” menu, type to find and select the BigQuery Job User role. This role gives the service account permission to do jobs.
  7. Click Continue, then click Done. You are returned to the “Service accounts” page.

In BigQuery, set up the dataset permissions required for the service account.

Set up BigQuery permissions for LaunchDarkly Data Export

If you use LaunchDarkly’s Data Export destination, you must follow these steps. Skip these steps if you use a custom SDK implementation to send events directly to your own pipeline.

Here’s how to set up the dataset permissions:

  1. In BigQuery, locate the dataset containing your events, and click the three-dot overflow menu next to its name. The menu opens.
  2. Click Share, then Manage Permissions. The “Manage permissions” page appears.
  3. Click Add principal. The “Add principals” menu opens.
  4. In the “New principals” field, paste the Email ID for the service account you created in the previous procedure.
  5. In the “Select a role” menu, click to expand and choose the BigQuery Data Viewer role. This permission is required to read event data for LaunchDarkly’s BigQuery Data Export destination.
  6. Click Save.

Follow these steps whether you use the Data Export destination or a custom SDK implementation to send events:

  1. In BigQuery, locate or create the dataset where you want the allevents table to be stored, and click the three-dot overflow menu next to its name. The menu opens.
  2. Click Share, then Manage Permissions. The “Manage permissions” page appears.
  3. Click Add principal. The “Add principals” menu opens.
  4. In the “New principals” field, paste the Email ID for the service account.
  5. In the “Select a role” menu, click to expand and choose the BigQuery Data Editor role. This permission is required to create and manage the allevents table.
  6. Click Save.

Now, test the integration:

Download the service account JSON key:

  1. Navigate to IAM and Admin, then click Service Accounts. The “Service accounts” page appears.
  2. Find the service account you created in the previous procedure, and click its name to open it.
  3. Click Keys, then Add Key.
  4. Choose Create new key from the dropdown. The “Create private key” dialog opens with JSON selected.
  5. Click Create. The JSON key automatically downloads to your computer.

Set up product analytics with BigQuery

You can set up product analytics with BigQuery if you are using a third-party customer data platform (CDP) to import your own events. To use the BigQuery Data Export destination, contact us.

Use a third-party customer data platform (CDP) to import your own events

Before you configure product analytics in LaunchDarkly, send the event data in your CDP to BigQuery and run a transformation to shape it into the format Launchdarkly requires.

Configure your custom SDK or CDP to send events to a table in your BigQuery project. These events must be transformed to match LaunchDarkly’s required schema in an allevents table. Here is the structure to use:

Column nameTypeDescription
device_idSTRINGUnique identifier for the device
user_idSTRINGUnique identifier for the user
event_nameSTRINGName of tracked event
event_idSTRINGUnique identifier for the event
server_tsTIMESTAMPServer-side timestamp of when the event was received
device_tsTIMESTAMPClient-side timestamp of when the event occurred
propertiesJSONEvent-specific properties of a JSON object
user_propertiesJSONUser-specific properties of a JSON object

Use the dataset you created in the previous procedure as the destination for the allevents table.

After you have configured your CDP or custom SDK, return to the “Configure BigQuery warehouse” screen in LaunchDarkly. Complete the following steps:

To use LaunchDarkly product analytics, you must first enable LaunchDarkly’s BigQuery Native product analytics integration. Here’s how:

  1. Click Product analytics in the left navigation, or find it by searching “BigQuery native product analytics” on the Integrations page.
  2. Click Configure. The “Configure BigQuery Native Product Analytics” menu opens.
  3. Choose an environment to set up the integration in. Click Next step.
  4. Select “Use CDP/Custom SDK” as an event tracking method. Click Next step. The “Configure BigQuery warehouse” menu opens.
  5. Give your BigQuery warehouse a human-readable Name.
  6. Enter your project ID in the Project ID field.
  7. Drag and drop the JSON file with your BigQuery credentials into the BigQuery credentials (JSON file) field.
  8. Read and click to acknowledge the Integration Terms and Conditions. Click Save configuration.

On the Product analytics screen in LaunchDarkly, the landing page will update to show a “Waiting for data…” status. Events and other information will begin to populate the screen within 15 minutes. Events from the last 30 days will be available within an hour. Load time varies based on the volume of data you’re importing from BigQuery.

To verify that data is loading, refresh the page. The Dashboards tab will not have any information in it until you create a dashboard, but you can confirm that setup was successful by checking the Events and Attributes tabs. After the import completes, both of those tabs display pre-populated data.

After the event data appears, you will be able to access different aspects of the product analytics UI.