Skip to main content
All CollectionsSettings & Configurations
Installing the Integration Code
Installing the Integration Code

Instructions on how to install Friendbuy on your website

Samantha avatar
Written by Samantha
Updated over a week ago

To complete this process, you must have access to your website source code, be relatively comfortable with HTML (or have a developer that can help you).
If you're already using Segment as a Destination, Segment installs our javascript snippets for you (see bottom of this article).

To install Friendbuy, a few snippets of code will need to be installed on your website. This code will allow you to place both Friendbuy referral and email capture widgets on your website. It will also keep track of any conversions that come in through your referral program. There are two mandatory snippets of code that need to be installed:

Site-wide Javascript snippet:

To get up-and-running, you’ll need to place our SmartPixel on your site. This is a snippet of JavaScript that enables widget functionality, as well as customer and conversion tracking.

  1. Log into your Friendbuy dashboard.

  2. In the left hand navigation menu, click on Settings > Integration Code.

  3. Include the SmartPixel on every page of your website that . For most web sites, this is accomplished by copying the code and pasting the SmartPixel once, immediately after your opening <head> tag, which should then make the SmartPixel available across all pages (secure & non-secure). If you are sending this to your developer, we recommend that you include instructions to insure that the SmartPixel is installed properly. Note: You will need to update the placeholders with variables based on your eCommerce specifications for the values, Shopify customers, can view here.

  4. Optionally, you can configure the JavaScript to pass additional information to Friendbuy for increased widget functionality.

Conversion Tracker snippet:

Conversions are completed transactions as the result of a referral (a friend makes a purchase). The most common conversion event is the purchase of a product.

  1. Log into your dashboard.

  2. In the left hand navigation menu, click on Settings > Integration Code.

  3. You should include the conversion tracking script on your conversion event page (most commonly, the Order Confirmation page). Copy the code and paste it between your opening <head> tags, just under the SmartPixel code. Note: You will need to update the placeholders with variables based on your eCommerce specifications for the values, Shopify customers can view here.

  4. Configure the "ID" parameter in the JavaScript so that a unique value is provided to Friendbuy for every conversion - a common example of this is an Order Number or Transaction ID. If your conversion event is something other than a purchase (ex. sign ups, registrations), you can pass a variable that provides us with a unique value for that event, such as a Sign Up ID.

  5. You can also pass additional information to us through the other parameters of the Conversion Tracker - the more information you provide to us, the more information will appear in your Friendbuy reports.

Widget Code:

Lastly, you'll copy and paste the Widget Installation Code snippet from the tab on each widget overview (/manage) onto the site pages you'd like to include (an exception to this would be when using 'Ribbon' for an overlay widget). Before going live, be sure to 'Publish' the widgets you plan to use in your referral program (top right of overview page), and 'Republish' after making any updates.

Automatic Code Installation for Segment Users:

Segment makes it easy to integrate Friendbuy with your website. Friendbuy's JavaScript snippets are automatically loaded and executed via Segment’s analytics.js library. So if you're using Segment, this eliminates the need to have your developer manually add and manage Friendbuy’s code directly on your site. Instead, enabling the integration will automatically:

  • Load Friendbuy widgets: Segment's existing page calls are mapped to Friendbuy’s push widget command

  • Notify Friendbuy about customers: Segment's existing identify calls are mapped to Friendbuy's track customer command

  • Notify Friendbuy of orders: Segment's existing track calls are mapped to Friendbuy's track order and track product command

Reference the detailed documentation and requirements from Segment here.

Did this answer your question?