Conversion Tracking

Fanplayr can easily track conversions made on your eCommerce store, which along with our user behavior tracking, can be used to analyze your store and identify opportunities to improve your business through targeting non-converting customer profiles.

Tracking Code Template

The following Javascript code template must be placed on the order confirmation page to track conversions. This should be the page customers view after the order process is complete. For example, this may a page your customers are returned to after an external payment gateway such as PayPal.

<!-- start Fanplayr Conversion Tracking -->
<script>
(function(d, w, s) {
  if ( !w.fp_sales_orders ) {
    w.fp_sales_orders = {
      version: 3,
      accountKey: '',
      storeDomain: '',
      data: {
        orderId: '',
        orderNumber: '',
        subTotal: 0.00,
        total: 0.00,
        discount: 0.00,
        discountCode: '',
        shipping: 0.00,
        tax: 0.00,
        currency: '',
        orderEmail: '',
        firstName: '',
        lastName: '',
        customerEmail: '',
        customerId: '',
        products: [
          {
            id: '',
            sku: '',
            price: 0.00,
            qty: 1,
            name: ''
          }
        ],
        cartAction: 'override'
      }
    };
    var js = d.createElement(s);
    var fjs = d.getElementsByTagName(s)[0];
    js.async = true;
    js.src = 'https://d1q7pknmpq2wkm.cloudfront.net/js/my.fanplayr.com/fp_custom_orders.js?' + (new Date().getTime());
    fjs.parentNode.insertBefore(js, fjs);
  }
})(document, window, 'script');
</script>
<!-- end Fanplayr Conversion Tracking -->

Config

version Integer

Required. Constant. Must be set to 3.

Tracking format version identifier used by the Fanplayr platform. Must be set to 3.

accountKey String

Required.

Unique string used identify your account with the Fanplayr platform.

storeDomain String

Defaults to the value of window.location.hostname.

Can be used to optionally override the domain that Fanplayr associates with the order.

Important. Some stores may use different domains for their checkout system. E.g. Users may browse your store at http://www.example.com, but the checkout and orders may be placed at https://www.checkout.com/example. In this case, it would be necessary to set storeDomain to "example.com" (the same domain linked to your Fanplayr campaign) so that the Fanplayr platform can seamlessly track the user and orders they place across these domains.

Order Variables

The following variables must be provided in the data object. Example:

{
  version: 3,
  accountKey: '7e43c8cddccade2b95ee5286ba89758a',
  data: {
    orderId: '005921',
    orderNumber: '005921',
    subTotal: 89.90,
    total: 79.90,
    discount: 10.00
  }
}

orderId String

Required.

The unique order identifier that is used internally by your system. This can be used later to reference transactions in your internal system.

This may be different from orderNumber, which is the order confirmation number provided to your users.

orderNumber String

Required.

The order confirmation number as seen by the user. This may be the same or different to orderId.

subTotal Float

Required.

The total value (in the specified currency) of the items in the order. More specifically, the sum total of the items in the order before discounts, shipping and taxes.

total Float

Required.

This is the total value (in the specified currency) of the items in the order. More specifically, the sum total of the items in the order before shipping and taxes, but after discounts.

discount Float

Required.

This is the total value of discounts applied to the cart. This means discounts such as free shipping or shipping discounts should not change this value.

discountCode String

Required.

The discount code applied to the order (if any). If there are multiple discount codes applied, separated them with commas.

shipping Float

The total shipping amount, afte any shipping-specific discount is applied.

tax Float

The total of all taxes applied to the order.

currency String

Defaults to "USD".

The ISO 4217 currency code of the product and order values being tracked.

orderEmail String

The email address the user provided for the order. This may be different from customerEmail.

firstName String

The first name of the user who placed the order. E.g. "John".

lastName String

The last name of the user who placed the order. E.g. "Smith".

customerEmail String

The email address of the current user.

customerId String

This is an identifier of the user that is internal to your site. This is used to track new and repeat users.

products Array<Object>|String

An array of objects (or JSON) representing the products in the order.

See Product Tracking for more details.

cartAction String

Defaults to "override".

This is a special variable that determines how Fanplayr will treat cart-related data for the current tracking call. It can be used to carry forward cart details (total value in cart, products in cart etc) from the previous page view if they are unavailable for the current tracking call.

See Cart Actions for more details.

Example

The following example could be used to track:

  • An order totaling $79.90 USD after the $10 "SUMMER10" discount is applied.
  • Consisting of a single product:
    • Red Shoes, priced at $89.90
<script>
(function(d, w, s) {
  if ( !w.fp_sales_orders ) {
    w.fp_sales_orders = {
      version: 3,
      accountKey: '7e43c8cddccade2b95ee5286ba89758a',
      storeDomain: 'example.com',
      data: {
        orderId: '005921',
        orderNumber: '005921',
        subTotal: 89.90,
        total: 79.90,
        discount: 10.00,
        discountCode: 'SUMMER10',
        shipping: 0.00,
        tax: 0.00,
        currency: 'USD',
        orderEmail: 'john.smith@gmail.com',
        firstName: 'John',
        lastName: 'Smith',
        customerEmail: 'john.smith@gmail.com',
        customerId: '10204723',
        products: [
          {
            id: 'WRS001',
            sku: 'WRS001',
            price: 89.90,
            qty: 1,
            name: 'Red Shoes'
          }
        ]
      }
    };
    var js = d.createElement(s);
    var fjs = d.getElementsByTagName(s)[0];
    js.async = true;
    js.src = 'https://d1q7pknmpq2wkm.cloudfront.net/js/my.fanplayr.com/fp_custom_orders.js?' + (new Date().getTime());
    fjs.parentNode.insertBefore(js, fjs);
  }
})(document, window, 'script');
</script>

results matching ""

    No results matching ""