BigCommerce Integration

Tracking orders from BigCommerce in Everflow (Big Commerce)

Chris Chimento avatar
Written by Chris Chimento
Updated over a week ago

Overview

This article covers how to connect your BigCommerce store to your Everflow account.


Step #1

  • When adding or editing an Offer for a BigCommerce integration, be sure of the following:

    • You have entered the BigCommerce store URL set as the Base Destination URL.

    • Direct Linking is enabled under Tracking & Control

For more information on Offer setup - [Click here]

Step #2

  • Next, you will need to add the Click script from the Offer to your BigCommerce account. You can find this in the Tracking card under the Click tab at the Offer Level.

  • Copy the code using the copy button at the bottom right:

Step #3

  • In BigCommerce, go to Storefront > Script Manager and then click the Create a Script button.

  • Name the script and select the following options:

    • Location on page: Head

    • Select pages where script will be added: All pages

    • Script category: Essential (if another option is selected here, customers will need to accept cookies in order for tracking to work)

    • Script type: Script

  • Take the code snippet that you copied from Everflow in Step #2 and paste it into the Script contents section:

Step #4

  • Modify the following script:

    <script type="text/javascript"
    src="https://www.INSERT_TRACKING_DOMAIN.com/scripts/sdk/everflow.js"></script>

    <script type="text/javascript">
    var aid = INSERT_ADVERTISER_ID;
    var orderId = {{checkout.order.id}};
    var orderItems;

    fetch('/api/storefront/order/' + orderId, { credentials: 'include' })
    .then(function (response) {
    return response.json();
    })
    .then(function (order) {
    console.log(order)
    if (order.coupons.length > 0) {
    orderItems = {
    oid: orderId,
    amt: order.orderAmount - (order.taxTotal + order.shippingCostTotal),
    bs: order.billingAddress.stateOrProvinceCode,
    bc: order.billingAddress.countryCode,
    cc: order.coupons[0].code,
    items: []
    };
    } else {
    orderItems = {
    oid: orderId,
    amt: order.orderAmount - (order.taxTotal + order.shippingCostTotal),
    bs: order.billingAddress.stateOrProvinceCode,
    bc: order.billingAddress.countryCode,
    cc: "",
    items: []
    };
    }
    for (var key in order.lineItems) {
    if (order.lineItems[key].length > 0 ) {
    order.lineItems[key].forEach(function(line_item) {
    var item = {};
    item['ps'] = line_item.sku;
    item['p'] = line_item.salePrice;
    item['qty'] = line_item.quantity;
    item['ds'] = line_item.discountAmount;

    orderItems.items.push(item);
    });
    }
    }
    EF.conversion({
    aid: aid,
    amount: order.orderAmount - (order.taxTotal + order.shippingCostTotal),
    order_id: orderId,
    coupon_code: order.coupons.length > 0 ? order.coupons[0].code : '',
    email: order.billingAddress.email,
    order: orderItems,
    })
    });
    </script>

  • Replace INSERT_ADVERTISER_ID with the Advertiser ID. The Advertiser ID can be located under Offers > Manage > Click the Offer > General card:

  • From the example above you would use 62 in that spot.

  • Please replace INSERT_YOUR_TRACKING_DOMAIN with the tracking domain found under Offers - Manage > Click the Offer - Tracking card:

  • In the example above, the domain is: www.clik2trk.com

  • Using the examples above, the code snippet would look like this:

    <script type="text/javascript"
    src="https://www.clik2trk.com/scripts/sdk/everflow.js"></script>

    <script type="text/javascript">
    var aid = 62;
    var orderId = {{checkout.order.id}};
    var orderItems;

    fetch('/api/storefront/order/' + orderId, { credentials: 'include' })
    .then(function (response) {
    return response.json();
    })
    .then(function (order) {
    console.log(order)
    if (order.coupons.length > 0) {
    orderItems = {
    oid: orderId,
    amt: order.orderAmount - (order.taxTotal + order.shippingCostTotal),
    bs: order.billingAddress.stateOrProvinceCode,
    bc: order.billingAddress.countryCode,
    cc: order.coupons[0].code,
    items: []
    };
    } else {
    orderItems = {
    oid: orderId,
    amt: order.orderAmount - (order.taxTotal + order.shippingCostTotal),
    bs: order.billingAddress.stateOrProvinceCode,
    bc: order.billingAddress.countryCode,
    cc: "",
    items: []
    };
    }
    for (var key in order.lineItems) {
    if (order.lineItems[key].length > 0 ) {
    order.lineItems[key].forEach(function(line_item) {
    var item = {};
    item['ps'] = line_item.sku;
    item['p'] = line_item.salePrice;
    item['qty'] = line_item.quantity;
    item['ds'] = line_item.discountAmount;

    orderItems.items.push(item);
    });
    }
    }
    EF.conversion({
    aid: aid,
    amount: order.orderAmount - (order.taxTotal + order.shippingCostTotal),
    order_id: orderId,
    coupon_code: order.coupons.length > 0 ? order.coupons[0].code : '',
    email: order.billingAddress.email,
    order: orderItems,
    })
    });
    </script>

Step #5

  • Click the Create a Script button again to add the Conversion script.

  • Name the script and select the following options:

    • Location on page: Footer

    • Select pages where script will be added: Order Confirmation

    • Script category: Essential (if another option is selected here, customers will need to accept cookies in order for tracking to work)

    • Script type: Script

  • Take the code snippet that you modified in Step #4 and paste it into the Script contents section:

  • You will now be able to track Clicks and Conversions from BigCommerce to your Everflow account.


Did this answer your question?