Segment.com Integration 

This article explains how Chargebee Retention integrates with Segment - a platform that collects, stores, and routes your user data in real-time.

Overview 

Chargebee Retention pushes out real-time notifications via Segment.com (as well as via our webhooks), when certain user, cancel and save-related events happen. This sends the raw event data and a payload of user metadata in real-time, without needing a request. This is particularly useful for any situation where real time notifications are critical for your awareness, for feeding data pipelines or warehouses, for real-time customer communications, or for triggering workflow in 3rd party systems (e.g. a post-cancel email).

How it works 

Chargebee Retention sends data to Segment as Track events (see list below), which includes the event name and properties, as show in the sample Track event posted below. Chargebee Retention also sends a Segment Identify call in sync with the 'page_loaded' event that happens when a user first visits the Chargebee Retention cancel page. This Identify call includes an extensive set of properties about the user (see sample below), and lets you tie a user to their actions and record traits about them.

Connecting Chargebee Retention to Segment takes two steps: 1) set up Chargebee Retention as a "Source" in Segment, then 2) enable the Segment integration from within the Chargebee Retention app.

Part 1: Set up Chargebee Retention as a Source in Segment.com 

  1. Login to Segment Account
  2. Under Overview, click "Add a Source"
  3. Under Catalog, type in "HTTP API" which should pop up on the right
  4. Click "HTTP API" and then click "Connect"
  5. Add a name under source Setup and click "Add Source"
  6. Once you add a source, you should see a write Key
  7. Copy your write key from the clipboard

Part 2: Connect Segment in the Chargebee Retention App 

  1. Log in to Chargebee Retention and click Settings in the lower left hand corner
  2. On the left side, see "Integrations"
  3. Navigate to "Segment" listed under "Integrations" and click "Connect"
  4. The modal will pop up that lists the benefits of connecting to Segment
  5. Paste your write key into the modal click "Save and Continue"

You will then see a green check mark next to Segment indicating it is connected

What 'Track' events are passed from Chargebee Retention into Segment?

Chargebee Retention sends data to Segment as Track events (below), which include the event name and properties associated with that event:

  • page_loaded: user has visited a Chargebee Retention cancel page
  • watchlist: user has first visited Chargebee Retention page and not canceled within 30 mins
  • cancel: user has confirmed the Chargebee Retention cancel request
  • save: the Watch List session has expired and the user did not cancel
  • deflect: any action has been clicked by the user to leave Chargebee Retention, including email, link, chat, offer, or schedule
  • email: user has clicked the modal-based Feedback submission
  • link: any link on Chargebee Retention has been clicked (includes modal actions and "Nevermind")
  • chat: a Chat request has been clicked
  • accept_offer: an Offer-type modal was clicked
  • schedule: a modal-based schedule request was clicked

Sample Segment 'track' event payload 

This is an example payload for a Chargebee Retention 'accept_offer' Segment (track) event.

{
"event": "accept_offer",
  "integrations": {},
  "messageId": "1c296cd0-509f-477e-bbc2-bd07e5b33d06",
  "originalTimestamp": "2020-11-06T00:53:10.886Z",
  "properties": {
    "app_id": "9Nyv3KZvQJ",
    "client_timestamp": "2020-11-06T00:53:10.815Z",
    "field.cancel.account.billing_id": "",
    "field.cancel.account.company_domain": "http://example.com",
    "field.cancel.account.company_name": "Chargebee Retention",
    "field.cancel.account.created_at": "1604621298",
    "field.cancel.account.internal_id": "9f827f6",
    "field.cancel.account.plan": "Premium",
    "field.cancel.account.plan_term": "monthly",
    "field.cancel.account.value": "1234",
    "field.cancel.app_id": "9Nyv3KZvQJ",
    "field.cancel.cancel_confirmation_url": "http://example.com?cancel_confirmation_url",
    "field.cancel.custom.test": "value",
    "field.cancel.email": "jane@example.com",
    "field.cancel.first_name": "Jane",
    "field.cancel.last_name": "Brighteyes",
    "field.cancel.save_return_url": "http://example.com?save_return_url",
    "field.cancel.subscription_id": "",
    "field.cancel.timestamp": "2020-11-06T00:50:48.207Z",
    "field.cookie": "86807c85-294c-4007-8a1d-9218dd52a714",
    "field.integrations.intercom.app_id": "vqcjqxff",
    "field.session_id": "1kbVVDN7b6",
    "field.standard.Cancel confirmation URL": "http://example.com?cancel_confirmation_url",
    "field.standard.Contract Value": 1234,
    "field.standard.Domain": "http://example.com",
    "field.standard.First Purchase Date": "2020-11-06T00:08:18.000Z",
    "field.standard.Instance ID": "9f827f6",
    "field.standard.Organization Name": "Chargebee Retention",
    "field.standard.Owner Email": "jane@example.com",
    "field.standard.Owner First Name": "Jane",
    "field.standard.Owner Last Name": "Brighteyes",
    "field.standard.Save return URL": "http://example.com?save_return_url",
    "funnel_id": 769,
    "modal_name": "25_discount.modal_email_send.a5ce8f6c-f35e-4112-80ba-75ccaa75a8f5",
    "session": "1kbVVDN7b6",
    "survey.brightback_reason": "too_expensive",
    "survey.competition": "",
    "survey.confirmation": "false",
    "survey.display_reason": "Pricing - don't see value",
    "survey.feedback": "",
    "survey.reason_for_leaving\[0\].lives_on": "tier0",
    "survey.reason_for_leaving\[0\].name": "reason_for_leaving",
    "survey.reason_for_leaving\[0\].tier": "tier0",
    "survey.reason_for_leaving\[0\].value": "pricing_dont_see_value.1834045247",
    "survey.selected_reason": "pricing_dont_see_value.1834045247",
    "survey.sentiment": 0,
    "user_cookie": "86807c85-294c-4007-8a1d-9218dd52a714",
    "user_id": "KD21akKyAZ",
    "version": "5a68148b"
  }
}

Sample Segment 'Identify' call 

Chargebee Retention includes an Identify call with each Segment track event, which lets you tie a user to their actions and record traits about them.

{
  "anonymousId": "KD21akKyAZ",
  "context": {
    "library": {
      "name": "unknown",
      "version": "unknown"
    }
  },
  "integrations": {},
  "messageId": "61932cbd-de99-48d7-891e-2dfa0555c845",
  "originalTimestamp": "2020-11-06T00:52:40.831Z",
  "receivedAt": "2020-11-06T00:52:50.887Z",
  "sentAt": "2020-11-06T00:52:50.829Z",
  "timestamp": "2020-11-06T00:52:40.889Z",
  "traits": {
    "cancel.account.billing_id": "",
    "cancel.account.company_domain": "http://example.com",
    "cancel.account.company_name": "Example",
    "cancel.account.created_at": "1604621298",
    "cancel.account.internal_id": "9f827f6",
    "cancel.account.plan": "Premium",
    "cancel.account.plan_term": "monthly",
    "cancel.account.value": "1234",
    "cancel.app_id": "9Nyv3KZvQJ",
    "cancel.cancel_confirmation_url": "http://example.com?cancel_confirmation_url",
    "cancel.custom.test": "value",
    "cancel.email": "jane@example.com",
    "cancel.first_name": "Jane",
    "cancel.last_name": "Brighteyes",
    "cancel.save_return_url": "http://example.com?save_return_url",
    "cancel.subscription_id": "",
    "cancel.timestamp": "2020-11-06T00:50:48.207Z",
    "user_cookie": "86807c85-294c-4007-8a1d-9218dd52a714",
    "user_id": "KD21akKyAZ"
  },
  "type": "identify",
  "userId": "9f827f6",
}
Was this article helpful?
Loading…