This article documents how JavaScript Sale Integration can be used to send details of a customer's purchase automatically to Feefo. 

Feefo offers an automated method for sending sales data that is obtained from your eCommerce website. By inserting a generated iFrame on your sale confirmation web page, each sale from the website will be processed automatically and the necessary information sent directly to Feefo. By default, only sales from the domain registered in the Feefo Hub under 'Settings > Brand Profile > Website Forwarding URL' (e.g. will be accepted. If you are wanting to have multiple subdomains (e.g., and sending JavaScript sales, please let us know and we will add the additional subdomains to your account. 

Each web page that will be using the iFrame must have the following code snippet added at the bottom of the section. Note that the order of this code is important with the Post Message Handler coming before the Initialisation.

<!-- Post message handler --> 

<!-- Initialise the Post Message Handler -->
<script type="text/javascript">
  var FPMH = new Feefo.PostMessageHandler();

The iFrame itself is then positioned below the code snippet but still within the section of each web page using the iFrame. An example of an iFrame for a single sale with two products is shown below:

style="display: none; "
width="0" height="0"
data-feefo-name="John Smith"
data-feefo-products='[{"description":"PS4 500GB Black","productsearchcode":"PS4500GBBLACK","amount":"299.99","productlink":"","currency":"GBP","tags":{"saleschannel":"Web","productline":"games"}},{"description":"Xbox One 500GB White","productsearchcode":"XBOXONE500GBWHITE","amount":"299.99","productlink":"","currency":"GBP","tags":{"saleschannel":"Web","productline":"games"}}]>

The attributes used within the iFrame are similar to those used by the Entersaleremotely API. A summary of each attribute is shown below but for more details see Entersaleremotely API Parameter Summary:

An example of how to generate the iFrame using a server-side script is shown below. This example is written in PHP but in practice will be in your preferred server-side scripting language.

$FeefoAPI = "";
$FeefoMerchantIdentifier = "example-retail-merchant";
// Sale values
$FeefoEmail = "";
$FeefoName = "John Smith";
$FeefoOrderref = "123456789";
$FeefoCustomerref = "123-456-789";
$FeefoFeedbackDate = "2015-08-11T11:30:00+01:00";
$feefoProducts = '[{"description":"PS4 500GB Black","productsearchcode":"PS4500GBBLACK","amount":"299.99","productlink":"","currency":"GBP","tags":{"saleschannel":"Web","productline":"games"}},{"description":"Xbox One 500GB White","productsearchcode":"XBOXONE500GBWHITE","amount":"299.99","productlink":"","currency":"GBP","tags":{"saleschannel":"Web","productline":"games"}}]';
// Output the iframe
echo "".
"  src='".$FeefoAPI."/sales/merchant?merchantidentifier=".$FeefoMerchantIdentifier."'".
"  width='0' height='0'".
"  data-feefo-email='".$FeefoEmail."'".
"  data-feefo-name='".$FeefoName."'".
"  data-feefo-orderref='".$FeefoOrderref."'".
"  data-feefo-customerref='".$FeefoCustomerref."'".
"  data-feefo-feedbackdate='".$FeefoFeedbackDate."'".
"  data-feefo-products='".$feefoProducts."'></iframe>";

The above example uses the same data as shown in the previous JavaScript iFrame example (a single sale with two products). The script firstly lists the variables which contain the sales data and then it outputs these values to the iFrame in their correct positions. The iFrame will then be rendered invisibly (it has no graphical elements) onto the order confirmation page and once applied, the sale information is submitted to Feefo.

Various checks against the sale are carried out to ensure only valid data is uploaded prior to sending it to Feefo. These checks include validating the merchant identifier, comparing the merchant’s stored domain on Feefo (if multiple subdomains will be sending us sales, register them by contacting our Technical Team) with the information supplied with the sale, and a ‘One Time Key’ (also known as a UUID (Universally Unique Identifier)) stored in the session (on Feefo’s servers) which validates the sale. If any of these checks fail, the sale is then rejected from Feefo and a feedback request email is not sent.

Although Feefo are unable to provide detailed support for server-side scripts, if any issues arise when working with Feefo’s iFrame, please contact Feefo's Technical Support.

Feefo's GnuPG Public KeyEntersaleremotely API