Apply to Cart Feature

Fanplayr widgets are capable of applying offer codes directly to your store's cart if supported. By supporting this feature, you increase the ease at which your visitors can convert into paying customers through Fanplayr's targeted offers.

How It Works

  1. You provide Fanplayr with a special applyToCartUrl URL as part of your user tracking implementation. E.g. https://example.com/applyOffer.php?code=%c
  2. Offer widgets that use the Apply to Cart feature will redirect the browser to this URL, replacing the %c variable with the offer code to be applied.
  3. Upon navigating to this URL your cart software must:
    1. Apply the specified offer code to the cart.
    2. Redirect the user to the cart page.
    3. Best Practice: If the offer is not successfully applied to the cart, show an informative message to the user explaining why the offer was not applied.

Example

The following example shows how you could configure the User tracking aspect of Fanplayr to support the Apply to Cart feature.

If the user is presented a targeted Free Shipping offer with the code FREESHIP, the widget would navigate the browser to https://example.com/applyOffer.php?code=FREESHIP when this feature is activated.

{
  type: 'st',
  accountKey: '7e43c8cddccade2b95ee5286ba89758a',
  applyToCartUrl: 'https://example.com/applyOffer.php?code=%c',
  data: {
    // User tracking data
  }
}

Using POST (or callback)

Sometimes you may not be able to simply hit a URL to apply a coupon. In this case you can supply a function to the Fanplayr platform to use when a user clicks the Apply button.

// fanplayr_ready function is called once the main Fanplayr scripts are loaded
window.fanplayr_ready = function(){ 
  window.fanplayr.platform.capabilities.applyToCart = function (event) { 
    // event.code is the coupon code to apply
    // here we are simply print the coupon to the console
    console.log(event.code);
  }; 
}

results matching ""

    No results matching ""