Looker includes a Segment integration that lets you query your data using Looker, and then send that data out to a variety of integrators managed by Segment. From there you can take actions on that data with third party applications like Marketo, Hubspot, and Urban Airship. This means you can trigger marketing campaigns, activate win-back campaigns, and define custom email cohorts right from the Looker interface using the the power of Looker and Segment.

Read our blog post, Segment Integration helps Close the Loop Between Data Analysis and Action, to learn more about what you can do with the Looker Segment integration.

Setting Up the Segment Integration

Follow the instructions below to configure Segment and Looker.

Setting Up Segment

In Segment, you need to create a Looker source and get the Segment Write Key.

After getting data from Looker to Segment, you can connect to a destination.

Create a Looker Source

Before enabling Segment in Looker, you have to configure a Looker Source in Segment:

  1. From the Segment Overview page, click View More Options.
  2. Scroll to the Looker Source and click on it:

  3. From the Looker page, click Connect.

  4. In the Source Setup page, click Add Source:

Copy the Segment Write Key

Once you have created a Looker source in Segment, copy the Segment Write Key:

  1. Within Segment, navigate to your Looker Source page, or access it at the URL segment.com/<your-segment>/sources/setup/looker, replacing <your-segment> with your Segment address.
  2. Click Copy to copy the Write Key to your clipboard.

Setting Up Looker

In Looker, you need to enable the Segment integration and add tags to your LookML model.

After setup, you can send data to segment.

Enable the Segment Integration

Use the Segment Write Key to enable communication with Segment within Looker:

  1. In Looker, click the Admin tab.
  2. Click Actions in the Platform section of the left menu panel.
  3. Click Enable. Note, if you have already enabled Segment on your instance, this button will say Edit.

  4. In the Segment page, set Enabled to ON.

  5. Paste your write key into the Segment Write Key field.

  6. Click Save.

Add Tags to your LookML Model

All Segment partners will require either the email or user_id field. Without the correct ID, your data will not make it to your supported integrations. You can see the required IDs for each supported Segment integration here.

Segment requires that you use the LookML tags parameter to identify the fields that store either a user’s email address or user_id.

Add the tags parameter to one or both of the identifying dimensions in your LookML model, like the examples below:

dimension: id { primary_key: yes type: number tags: [“user_id”] sql: ${TABLE}.id ;; }
dimension: email { tags: [“email”] sql: ${TABLE}.email ;; }

Send Data From Looker to Segment

Once you have enabled the Segment Integration, sending data to Segment is simple. You can either send data immediately or on a schedule.

To send data to Segment immediately:

To send data to Segment on a schedule:

  1. Opening or creating a Look with the data you want to send to your Segment partner. Be sure to include either the user email or the user_id field as needed by your Segment partner.

  2. Create a schedule for your Look, and select Segment as the destination. You can schedule the Look to be sent to Segment and your Segment partner on a regular interval, or you can send the report once by clicking Send Test.

Whether sending immediately or on a schedule, you can confirm that your data was received by Segment using the Segment debugger. Navigate to your Looker Source page within Segment and click the Debugger tab, or access the debugger at the URL segment.com/<your-segment>/sources/looker/debugger. When you send data to Segment, you should see a list of records received by Segment in the debugger.

Connect Segment to One or More Destinations

When you can successfully send data to Segment, you can then set up the destinations. In Segment, click the Destinations button in your Looker Source page. From there you can configure and connect to Marketo, Hubspot, and a number of other data destinations to automate your Looker workflows.