Friendbuy Cloud Mode (Actions) Destination
Friendbuy powers referral programs for e-commerce merchants of all sizes, providing an easy solution to launch Refer-a-Friend programs and accelerate growth through word of mouth.
Friendbuy's cloud mode Segment integration allows you to send data to Friendbuy from your data center so that Friendbuy can act on it. For example, you could trigger a reward when a referred customer performs a rewardable event or send customer data to use in your Friendbuy-managed loyalty/rewards program.
If you're using Segment with a Friendbuy referral program you probably want to use the web destination to configure the Friendbuy JavaScript and to send customer and purchase data directly to Friendbuy as the user interacts with your web site. However, if you also want to send events from your data center to Friendbuy, such as purchases due to recurring transactions, you should also use this cloud mode destination action, which provides an interface between Segment's identify and track calls and Friendbuy's MAPI (merchant API).
The Friendbuy cloud mode destination sends information about your customers and their actions to Friendbuy. It supports the following Friendbuy MAPI events.
- Track Customer: Converts Segment Identify calls to Friendbuy track customer MAPI calls. Use this to add your customer ID and other customer data to the information that Friendbuy has about the customer.
- Track Purchase: Converts Segment Order Completed calls to Friendbuy track purchase MAPI calls. Use this to send purchase data to Friendbuy and reward advocates based on their friends' purchases.
- Track Sign-Up: Converts Segment Signed Up calls to Friendbuy track sign_up MAPI calls. Use this to reward customers for account creation and other sign-up actions.
- Track Custom Event: Converts an arbitrary Segment
analytics.trackcall with an event name and properties of your choosing to a Friendbuy track custom event MAPI call. Use this to reward your customers for actions other than purchases or sign-ups.
Friendbuy Cloud Mode (Actions) is the Segment cloud mode destination that works with Friendbuy's current platform. The classic Segment Friendbuy destination works with Friendbuy's legacy platform.
Info
Please contact your Friendbuy Customer Success Manager or email support@friendbuy.com to set up Friendbuy's Segment integration.
- You need your Friendbuy MAPI Key and MAPI Secret to use the Friendbuy cloud mode integration. Contact your Friendbuy Onboarding & Implementation Representative to have these generated for you. (These are not the same as the Merchant ID and Secret Key that are available in your Friendbuy account.)
- From the Segment web app, click Catalog, then click Destinations.
- Filter the destinations on Friendbuy in the Catalog and select Friendbuy (Cloud Destinaton). Click Configure (Cloud Destination) to configure the Friendbuy destination, and choose which of your sources to connect the destination to.
- Give the destination a name, and fill in the settings manually.
- On the Basic Settings page enter your Friendbuy MAPI Key and Friendbuy MAPI Secret values from step one, and click Save Changes.
- Select the Mappings tab. Click the + New Mapping button. A dialog will pop up showing the supported Friendbuy actions. Click the desired type of action you want to send to Friendbuy and configure it using the steps described below.
Contact your Friendbuy account manager to generate your Friendbuy MAPI key and secret.
See Friendbuy MAPI Key.
Build your own Mappings. Combine supported triggers with the following Friendbuy (Cloud Destination)-supported actions:
Mapping limits per destination
Record when a customer completes any custom event that you define.
Track Custom Event is a Cloud action.
The type of the event to track.
Object containing the properties for the event being tracked. All of the fields in this object will be sent in the root of the Friendbuy track event.
Optional
An identifier for the event being tracked to prevent the same event from being rewarded more than once.
The user's customer ID.
Optional
The user's anonymous id
The user's email address.
Optional
The URL of the web page the event was generated on.
Optional
The title of the web page the event was generated on.
Optional
The browser's User-Agent string.
Optional
The users's IP address.
Record when a customer signs up for a service.
Track Sign Up is a Cloud action.
The user's customer ID.
Optional
The user's anonymous ID.
The user's email address.
Optional
Flag to indicate whether the user is a new customer.
Optional
The status of the user in your loyalty program. Valid values are "in", "out", or "blocked".
Optional
The user's given name.
Optional
The user's surname.
Optional
The user's full name.
Optional
The user's age.
Optional
The user's birthday in the format "YYYY-MM-DD", or "0000-MM-DD" to omit the year.
Optional
Coupon code that customer supplied when they signed up.
Optional
Friendbuy attribution ID that associates the customer who is signing up with the advocate who referred them.
Optional
Friendbuy referral code that associates the customer who is signing up with the advocate who referred them.
Optional
Custom attributes to send to Friendbuy. You should pass an object whose keys are the names of the custom attributes and whose values are strings. Non-string-valued attributes will be dropped.
Optional
The URL of the web page the event was generated on.
Optional
The title of the web page the event was generated on.
Optional
The browser's User-Agent string.
Optional
The users's IP address.
Create a new customer profile or update an existing customer profile.
Track Customer is a Cloud action.
The user's customer ID.
Optional
The user's anonymous id.
The user's email address.
Optional
The user's given name.
Optional
The user's surname.
Optional
The user's full name. If the name trait doesn't exist then it will be automatically derived from the firstName and lastName traits if they are defined.
Optional
The user's age.
Optional
The user's birthday in the format "YYYY-MM-DD", or "0000-MM-DD" to omit the year.
Optional
The user's language.
Optional
The user's country.
Optional
The user's state.
Optional
The user's city.
Optional
The user's postal code.
Optional
The date the user became a customer.
Optional
The status of the user in your loyalty program. Valid values are "in", "out", or "blocked".
Optional
Flag to indicate whether the user is a new customer.
Optional
Custom attributes to send to Friendbuy. You should pass an object whose keys are the names of the custom attributes and whose values are strings. Non-string-valued attributes will be dropped.
Optional
The URL of the web page the event was generated on.
Optional
The title of the web page the event was generated on.
Optional
The browser's User-Agent string.
Optional
The users's IP address.
Record when a customer makes a purchase.
Track Purchase is a Cloud action.
The order ID.
Purchase amount to be considered when evaluating reward rules.
The currency of the purchase amount.
Optional
The coupon code of any coupon redeemed with the order.
Optional
Friendbuy attribution ID that associates the purchase with the advocate who referred the purchaser.
Optional
Friendbuy referral code that associates the purchase with the advocate who referred the purchaser.
Optional
An array of gift card codes applied to the order.
Optional
Products purchased.
Optional
The user's customer ID.
Optional
The user's anonymous ID.
Optional
The user's email address.
Optional
Flag to indicate whether the user is a new customer.
Optional
The status of the user in your loyalty program. Valid values are "in", "out", or "blocked".
Optional
The user's given name.
Optional
The user's surname.
Optional
The user's full name.
Optional
The user's age.
Optional
The user's birthday in the format "YYYY-MM-DD", or "0000-MM-DD" to omit the year.
Optional
Custom attributes to send to Friendbuy. You should pass an object whose keys are the names of the custom attributes and whose values are strings. Non-string-valued attributes will be dropped.
Optional
The URL of the web page the event was generated on.
Optional
The title of the web page the event was generated on.
Optional
The browser's User-Agent string.
Optional
The users's IP address.
There are four steps to configure a Segment mapping.
- Set up event trigger: Choose the event trigger, which is the event type (such as Identify) or event name (such as Order Completed) for events that should be sent to Friendbuy.
- Test event trigger: Find a sample event in your Segment event stream that matches the trigger you defined in step one.
- Configure action fields: Define how the fields in the Segment event are mapped to fields in the Friendbuy track event.
- Review mappings: Verify that the fields in the sample event are mapped correctly.
Info
If you use the Friendbuy web mode destination to handle events generated in the browser as recommended, then when you configure the event trigger in the cloud mode destination you might need to add an extra condition to prevent events that come from Analytics.js calls from being handled by both the web and cloud mode destinations. For example, if you configure a Track Purchase action in the cloud mode destination to handle purchases for a recurring subscription, you might want to add an event property named source with the value data center to the recurring purchase events that you submit to Segment's REST interface. Then, add a condition on that property in the action's trigger so that only Order Completed events in which the Event Property source has the value data center are handled by that action. This prevents ordinary purchases sent from Analytics.js and processed by the Friendbuy cloud mode destination from being sent a second time by the web mode destination.
In the configure action fields step, the mapping is pre-populated with mappings from the standard Segment event properties to the corresponding Friendbuy fields. You can edit each field if you want to populate that field from a different Segment event property or not send the field at all.
In the Track Customer, Track Purchase, or Track Sign Up mappings you can use the Custom Attributes field to send additional custom properties that aren't included in the predefined field names for that event. Use the mapping's Custom Attributes field to specify the path to a JSON object that contains those custom attributes. Then, when your code makes its Segment Analytics.js call, include an object at the path that you configured containing your custom attributes. These attributes will then be included in the additionalProperties object in the Friendbuy MAPI call.
For example, if your Track Purchase call has the default Custom Attributes value of properties.friendbuyAttributes, and if your track purchase call is:
1{2"type": "track",3"event": "Order Completed",4"source": "data center",5"userId": "customer-12345",6"properties": {7"order_id": "82f250a3-32eb-40be-95fc-77e685ed8448",8"email": "joe.customer@example.com",9"total": 54.82,10"currency": "USD",11"friendbuyAttributes": {12"orderNumber": "3",13"promotion": "black friday"14}15}16}
then the Friendbuy MAPI purchase call will be:
1{2"orderId": "82f250a3-32eb-40be-95fc-77e685ed8448",3"email": "joe.customer@example.com",4"customerId": "customer-12345",5"amount": 54.82,6"currency": "USD",7"additionalProperties": {8"orderNumber": "3",9"promotion": "black friday"10}11}
Note that a Friendbuy MAPI call is limited to a maximum of 10 additional properties, additional properties' values must be strings, and the maximum length of an additional property's value is 128 characters. Additional properties that don't comply with these restrictions are dropped.
To allow Friendbuy to act on an event that isn't one of the standard events described in the Overview, use a custom event.
To configure a custom event:
- Click New Mapping and choose Track Custom Event.
- When you configure the event trigger, for the Event Name choose the name of the Segment event you're tracking. For example, if you want to reward on app downloads that you're tracking with
{ "type": "track", "event": "Downloaded", ... }, useDownloadedas the Event Name in the trigger. - When you configure your action fields, you can accept the default Event Type of
eventwhich will cause Friendbuy to receive track events with the same names as the Segment events. If you want to rename the Friendbuy events, you can replace the Event Type with a different value, such as the static stringdownload. - Event Properties is set from the path
propertiesby default, which means that all the properties that you include in your Segmentanalytics.trackcall are passed to Friendbuy. If you only want to pass custom attributes to Friendbuy, you need to segregate the fields to pass to Friendbuy into an object and then specify the path to that object, similar to what is described above in Custom Attributes. - To prevent an event that is tracked multiple times from being rewarded more than once, you should include a deduplication ID in your event as described in Friendbuy's Track Custom Event documentation. You can either pass an explicit Event ID field in your event (defaulting to the
deduplicationIdproperty) or you can create the Event ID out of other event properties (such as theuserId, a., and theproperties.downloadIdin the above example).