Order tracking
Tracks orders placed on your site.
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.
Configuration
version
Type:
integer
Scope: All pages
Required
Tracking format version identifier used by the Fanplayr platform. Must be set to 3
.
accountKey
Type:
string
Scope: All pages
Required
Unique string used identify your account with the Fanplayr platform.
storeDomain
Type:
string
Scope: All pages
Default: Value of
window.location.hostname
Can be used to optionally override the domain that Fanplayr associates with the order.
Some stores may use different domains for their checkout system. E.g. Users may browse your store at https://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.
connect
Type:
object
Scope: All pages
Default:
undefined
The path to the server-side page for Enhanced User Identification.
Tracking variables
The following variables must be provided in the data
object. Example:
orderId
Type:
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
Type:
string
Required
The order confirmation number as seen by the user. This may be the same or different to orderId
.
gross
Type:
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
Type:
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
Type:
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
Type:
string
Required
The discount code applied to the order (if any). If there are multiple discount codes applied, separated them with commas.
shipping
Type:
float
Default:
0
The total shipping amount, after any shipping-specific discount is applied.
tax
Type:
float
Default:
0
The total of all taxes applied to the order.
currency
Type:
string
Default:
"USD"
The ISO 4217 currency code of the product and order values being tracked.
orderEmail
Type:
string
The email address the user provided for the order. This may be different from customerEmail
.
firstName
Type:
string
The first name of the user who placed the order. E.g. "John".
lastName
Type:
string
The last name of the user who placed the order. E.g. "Smith".
customerEmail
Type:
string
The email address of the current user.
customerId
Type:
string
This is an identifier of the user that is internal to your site. This is used to track new and repeat users.
products
Type:
Array<Product>
| string
An array of objects (or JSON) representing the products in the order.
cartAction
Type:
CartAction
Default:
"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.
Custom Data
You can track additional order details as custom data using the custom_data
object:
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
Last updated