Integrating with Segment

Segment is an analytics collection platform that passes user and event data to other platforms for analytics, tracking, and business intelligence purposes. By taking a few steps to coordinate your TUNE and Segment accounts, you’ll be able to route that data to TUNE.

1. Check Settings in TUNE

In TUNE, make sure your offer uses the Server Postback w/Transaction ID tracking protocol. You can change an offer’s tracking protocol from the offer’s page. At the top of the Details panel, click Edit. On the page that appears, set Conversion Tracking to “Server Postback w/Transaction ID”.

Next, you’ll need to update your tracking settings for custom tracking domains. To do this, go to Company > Customize Application > Settings > Tracking. Then, set Maintain Custom Tracking Domains to “Disabled”.

2. Enable Integration in Segment

Once your offer is ready in TUNE, you’ll need to enable the integration in Segment.

To turn on the TUNE integration, go to your project page and select the Integrations tab. From there, find and enable the TUNE integration:

On the page that appears, select the Settings tab. Enter your TUNE Network ID, and click Save Changes when you’re finished. Your Network ID is the first part of your TUNE URL:

3. Update Your Project

Before continuing with the integration, you need to have Segment set up for your project. That means analytics.js is imported wherever necessary, and that identify and track are working properly for events you care about.

To connect to TUNE, modify the identify and track calls in your project using the steps below.


When connecting to TUNE, the transaction_id needs to be captured and passed to Segment from the landing page URL. In places where you call identify, include a way to get URL parameters and values from the query string—specifically to capture the TUNE transaction_id value:

var vars = getUrlVars();
var tid = if 'tid' in vars ? vars['tid'] : vars['transaction_id'];

To pass this information to Segment, include transaction_id (with its value from above) in the traits field of identify. You can use other traits as well. Just make sure to replace values in the call as you normally would for Segment.

analytics.identify(REPLACE_WITH_USER_ID, {
  transaction_id: tid, 


Next, you need to include the TUNE transaction_id value into Segment tracking. In places where you call track, load the transaction_id value from the traits array:

  var traits = analytics.user().traits();
  analytics.track("REPLACE_WITH_EVENT_NAME", {
    adv_sub: REPLACE_WITH_VALUE,
    adv_sub2: REPLACE_WITH_VALUE,
    adv_sub3: REPLACE_WITH_VALUE,
    adv_sub4: REPLACE_WITH_VALUE,
    adv_sub5: REPLACE_WITH_VALUE,
    goal_id: REPLACE_WITH_VALUE,
    sale_amount: REPLACE_WITH_VALUE,
    hasoffers: {
      transaction_id: traits['transaction_id']

To include more information, you can optionally put additional TUNE parameters in the properties field of track. Like with identify, replace values in the call as you normally would for Segment.

Tip: All currently available optional parameters for this integration are included in the above snippet.

Having Trouble?

The above code snippets are ready to use in your project. However, you may need to modify them slightly to match how the project itself is implemented in your system.

For more help setting up this integration, contact the Segment support team. You can also find more detailed information on analytics.jsanalytics.identify(), and analytics.track() in their technical documentation.