Friendbuy Destination

Getting Started

Setting up Friendbuy is very simple! Just login to your Friendbuy account, go to Integration Code > and copy the Site ID above the snippet box. Then paste it into your Friendbuy Destiation setting back in the Segment UI as seen in the gif below:

This Destination allows you to:


In order to load specific widgets on your various web pages, you can configure your settings to map your named .page() call(s) to your desired Friendbuy Widget(s). You will also be able to configure a number of optionally advanced widget configurations such as auto delay and custom parameters. See the following gif for example:

There are two types of Widgets you can map to your .page() calls:

  • Site Wide Widgets
    • These types of widgets are recommended by Friendbuy to load on all your webpages. If you wish to use these types of widgets, you can add them under the Side Wide Widgets setting. NOTE: You are NOT required to map a site wide widget if the Call To Action type is a ribbon served by Friendbuy. This type of overlay widget will just load when we boot up Friendbuy’s library.
  • Other widgets  - All other widgets will fall under this category whereby you can map the name of a unique Segment .page() call to a widget ID.

NOTE: If you have mapped a site wide overlay widget loads on every .page() call, even if we have loaded a different widget on the page that you have explicitly mapped.


When you call .identify(), we will send the following mapped traits:

Segment Traits Friendbuy Standard Fields
userId id REQUIRED
email email
firstName first_name
lastName last_name

Here is a sample Javascript .identify() call with the all the standard traits:

analytics.identify('2', {
  firstName: 'Buzz'
  lastName: 'Lightyear',
  email: '',

NOTE: Friendbuy does not accept any custom traits.

Stripe and Chargebee Customer ID

If you are integrated with Stripe or Chargebee and would like to send those IDs to Friendbuy, you can pass them as integration specific options:

analytics.identify('2', {
  firstName: 'Buzz'
  lastName: 'Lightyear',
  email: '',
}, {
  integrations: {
    Friendbuy: {
      stripeCustomerId: <>,
      chargebeeCustomerId: <>

Track / Order Completed

This Destination accepts only Order Completed events as decribed in our ecommerce spec.

Friendbuy has a concept of Order Tracking and Product Tracking where the former describes how to send data about the top level order whereas the latter documents instructions on sending data about each of the product within that order.

When sending the order details, we will make the following translation:

Segment Properties Friendbuy Standard Fields
order_id id REQUIRED email
revenue amount
coupon coupon_code

Then we will iterate over each item in your properties.products and send the following mapping:

Segment Properties Friendbuy Standard Fields
sku sku
price price
quantity quantity

NOTE: You can optionally specify if the customer who made the order is a new customer by passing new_customer under your integration specific options:

  integrations: {
    Friendbuy: {
      newCustomer: true,

Supported Sources and Connection Modes

Before you start, make sure Friendbuy supports the source type and connection mode you’ve chosen to implement. You can learn more about connection modes here.

Web Mobile Server
📱 Device-mode
☁️ Cloud-mode


Segment lets you change these destination settings from the Segment app without having to touch any code.

Page Widgets

Map your page calls to specific FriendBuy Widgets.

Site ID

This is your Site ID. It is used to identify your account in our platform so we can properly attribute referral data. You can find your Site ID in the in Friendbuy web application at Settings > Integration Code

Site Wide Widgets

By default, Friendbuy recommends you add a site wide overlay widget. You can enter any of these site wide widgets here and we will load them any time we receive a .page() call. Note: If you have custom widgets mapped to named pages in the Widgets setting and you have provided a site wide widget, we will load both.

Adding Friendbuy to the integrations object

To add Friendbuy to the integrations JSON object (for example, to filter data from a specific source), use one of the following valid names for this integration:

  • FriendBuy

  • Friendbuy

This page was last modified: 09 Jun 2020

Get started with Segment

Segment is the easiest way to integrate your websites & mobile apps data to over 300 analytics and growth tools.
Create free account