Module: styliticsTrackPurchase

Sends purchase tracking data to Stylitics to help us deliver reports on key metrics
Parameters:
Name Type Description
params Object
Properties
Name Type Attributes Default Description
client string The username given to you by Stylitics
orderId string A unique ID for this order. This is useful for reconciling Stylitics' metrics with client metrics per order
orderTotal number the total cost of the customer's order without shipping, tax or individual promo-code discounts
items Array.<Object> The items that make up this order. If more than one of the same item is purchased in the same order, enter that item object N times for N quantity of the item purchased.
Properties
Name Type Description
id string The id for each item in the order. These should correspond to the same type of identifier you pass to the Stylitics Widget, typically a colorway-level ID (should be the same identifiers you give as "item_number" in the widget config)
price number the cost of each item in the order.
currency string <optional>
"USD" If this purchase was completed using a currency other than US Dollars pass an ISO 4217 Alphabetic code for the currency used. (e.g. "CAD")
locale string <optional>
See `locale` in the widget's class documentation; use the same locale here.
environment "production" | "staging" <optional>
"production" Set this to "staging" only in your staging environments in order to send purchase events to the Stylitics staging tracking environment.
Source:
Examples
Can be used via a module:

<script type="module">
  import styliticsTrackPurchase from "https://web-assets.stylitics.com/purchase-tracking/latest/purchase_tracking.js";
  styliticsTrackPurchase({
     // in your staging environment please uncomment:
     // environment: "staging",
     client: "your-stylitics-username",
     orderId: "Ord-123",
     orderTotal: 95.25,
     items: [
     {
       id: "item-id-234",
       price: 35.00
     },
     {
       id: "item-id-342",
       price: 60.25
     }]})
</script>
Can also be used via a script:

<script src="https://web-assets.stylitics.com/purchase-tracking/latest/purchase_tracking_iife.js"></script>
<script>
StyliticsPixel({

     // in your staging environment please uncomment:
     // environment: "staging",
     client: "your-stylitics-username",
     orderId: "Ord-123",
     orderTotal: 95.25,
     items: [
     {
       id: "item-id-234",
       price: 35.00
     },
     {
       id: "item-id-342",
       price: 60.25
     }]})
</script>