![]() |
Important: The BigCommerce x ReSci integration must be enabled for your account before data can be pushed from your BigCommerce account into Cortex. |
The BigCommerce x ReSci integration makes it easy to onboard to ReSci by syncing your e-commerce data into Cortex’s customer data platform. This provides actual business data to train our AI, providing you with a unified profile of your customers and allows Cortex to make personalized recommendations based on actual purchase history, browsing activity, and demographics.
- Data streams from BigCommerce to ReSci
- Requirements for setup
- Data mapping
- Customers vs. subscribers
- JavaScript implementation
Data streams from BigCommerce to ReSci
The BigCommerce x ReSci integration pulls the below data streams from BigCommerce into Cortex for use in segmentation, training our AI models, etc.
BigCommerce –> ReSci
- customers –> users
- newsletter_subscribers –> users
- categories –> categories
- products –> items
- orders –> orders
- order_products –> order_items
Requirements for Setup
In order to enable the integration for BigCommerce, you will need to provide our team with the below (you can find this information by following these instructions):
- Client ID
- Client Secret
- OAuth Access Token
- Name
- API Path
- API Permissions that match the settings below:
Data Mapping
The below mapping outlines exactly where we pull data from BigCommerce to populate the corresponding fields in ReSci. This is noted for each data schema:
Users
BigCommerce |
ReSci |
customers.id |
record_id |
newsletter_subscribers.email |
|
newsletter_subscribers.date_created or customers.date_created |
account_created_on |
newsletter_subscribers.first_name + “ “ + newsletter_subscribers.last_name |
full_name |
customers.addresses[0].street_1 |
address1 |
customers.addresses[0].street_2 |
address2 |
customers.addresses[0].city |
city |
customers.addresses[0].state |
state |
customers.addresses[0].zip |
zip |
customers.addresses[0].country |
country |
phone |
phone |
customers.registration_ip_address |
ip_address |
newsletter_subscribers.source |
registration_source |
if(customers.accepts_marketing == false) set to today |
date_unsubscribed |
If using Big Commerce "Form Fields" to collect & populate Birthday, Gender, and Registration Source, utilizing the following format:
Big Commerce Form Field | ReSci |
birthday | birthday |
gender | gender |
registration_source | registration_source |
Categories
BigCommerce |
ReSci |
categories.id |
record_id |
categories.name |
name |
categories.description |
description |
categories.parent_id |
parent_record_id |
Items
BigCommerce |
ReSci |
products.sku |
record_id |
products.name |
name |
products.price |
price |
products.availability == “available” |
active |
store.secure_url + products.custom_url.url |
item_url |
products.sku |
model |
products.inventory_level |
quantity |
products.variants[].image_url |
image_list |
products.categories |
categories |
products.variants[].product_id |
parent_record_id |
Orders
BigCommerce |
ReSci |
orders.id |
record_id |
orders.customer_id |
user_record_id |
orders.billing_address.email |
|
orders.total_inc_tax |
total_price |
orders.date_created |
ordered_at |
orders.discount_amount |
discount_amount |
orders.shipping_cost_inc_tax |
shipping_amount |
orders.total_tax |
tax_amount |
orders.payment_method |
payment_method |
orders.status |
order_status |
Order Items
BigCommerce |
ReSci |
order_products.order_id |
order_record_id |
order_products.product_id |
item_record_id |
order_products.name |
name |
order_products.price_inc_tax |
price |
order_products.quantity |
quantity |
order_products.categories |
categories |
Customers vs. Subscribers
Our BigCommerce integration identifies customers and subscribers distinctly so you have insight into which of your users has created an account or successfully placed an order, versus just signed up to receive emails from your newsletter form. If you are using BigCommerce’s built-in newsletter subscriber form, you will automatically have these subscribers synced from BigCommerce into ReSci.
Data distinctions between customers and subscribers
The way our integration distinguishes between customers and subscribers is by using the key identifier user.record_id (see below). Using this value, you’re easily able to understand which of your users is just a subscriber or which is a customer.
For segmentation purposes, you can drill deeper into your data and easily target just your subscribers by segmenting by those users who have not yet made a purchase but are subscribed to email.
See below for more information on how we differentiate between the two:
Customers
- Customers are defined as those users who have created an account with you / successfully completed an order.
- The user.record_id value for customers is the customers.id value in BigCommerce.
- Customers are synced to your master “all users” segment in Cortex.
Subscribers
- Subscribers are defined as those users who have signed up from your built-in newsletter form but not yet created an account / successfully completed an order.
- The user.record_id value for subscribers is an MD5(lower) of the subscribers' email address.
- Subscribers are also synced to your master “all users” segment in Cortex.
JavaScript Implementation
Our normal JavaScript needs to be adapted for use in BigCommerce so that we can track user behavior in real-time. There are a couple of steps needed to ensure that our JavaScript is working as needed:
Create ReSci’s Tracking Script using BigCommerce’s Script Manager Tool
BigCommerce has a built-in tool that we’ll use to implement our JavaScript to track user behavior in real-time.
- Navigate to “Storefront” and “Script Manager”.
- Click “Create a Script” and in the “Name of script” field, enter “ReSci JS”.
- The configuration of the script should note the “Location on page” as “Head”, “Select pages where script will be added” as “All pages”, and “Script type” as “Script”.
- In the “Script contents” section, paste the below code snippet and ensure that you replace the
site_id
variable with your correctsite_id
value, and reference your DOM elements appropriately, particularly in window.frames.document.getElementById('form-action-addToCart').
Note: If you need assistance locating your site_id, contact help@retentionscience.com.
<script type="text/javascript">
window._rsq = window._rsq || [];
window._rsq.push(['_setSiteId', 'site_id']); // replace with your site_id
window._rsq.push(['_enableOnsite']);
{{#if customer}}
window._rsq.push(['_setUserId', '{{ customer.id }}']);
window._rsq.push(['_setUserEmail', '{{ customer.email }}']);
{{/if}}
/*** EVENT SPECIFIC CODE ***/
{{#if product}}
window._rsq.push(['_addItem', {'id': '{{ product.sku }}'}]);
{{/if}}
{{#if page_type '==' 'search'}}
window._rsq.push(['_setAction', 'search']) ;
window._rsq.push(['_setParams', { 'term': '{{ forms.search.query }}'}]);
{{/if}}
{{#if page_type '==' 'cart'}}
{{#forEach cart.items}}
window._rsq.push(['_addItem', { 'id':'{{ sku }}', 'name':'{{ name }}', 'price':'{{ price.value }}' }]);
{{/forEach}}
window._rsq.push(['_setAction', 'shopping_cart']);
{{/if}}
/*** FUNCTION FOR AJAX TRACKING ***/
var _rs_ajax = {};
_rs_ajax.updateCart = function(){ //This is required for ajax cart views
{{#if product}}
window._rsq.push(['_addItem', { 'id':'{{ product.sku }}', 'name':'{{ product.title }}', 'price':'{{ product.price.without_tax.value }}' }]);
window._rsq.push(['_setAction', 'shopping_cart']);
window._rsq.push(['_track']);
{{/if}}
};
/*** END FUNCTION FOR AJAX TRACKING ***/
window.addEventListener('DOMContentLoaded', function(){
/*** FUNCTION FOR ADD TO CART EVENT ***/
{{#if product}}
window.frames.document.getElementById('form-action-addToCart').addEventListener("click", function(){
_rs_ajax.updateCart();
});
{{/if}}
window.frames.document.getElementById('nl_email').addEventListener("change", function(){
window._rsq.push(['_setUserEmail', window.frames.document.getElementById('nl_email').value.toString()]);
window._rsq.push(['_track']);
});
});
/*** END ADD TO CART EVENT ***/
/*** EMAIL CAPTURE EVENT ***/
window.addEventListener('DOMContentLoaded', function(_rsq){ document.getElementById("email_signup").addEventListener("submit", function(){ // update the param within getELementById to the ID name of the email capture form
var uEmail = document.getElementById('k_id_email').value;
// update the param getELementById to the ID name of the email input window._rsq.push(['_setUserEmail', uEmail]); window._rsq.push(['_setUserProperties', { 'record_id': md5(uEmail.toLowerCase()),'email':uEmail, 'registration_source':'footer'}]); // (Optional) You can pass any ReSci standard user data point window._rsq.push(['_setAction', 'email_entered']); window._rsq.push(['_track']); }); });
/*** END EMAIL CAPTURE EVENT ***/
/*** END EVENT SPECIFIC CODE ***/
window._rsq.push(['_track']);
(function() {
var rScix = document.createElement('script');
rScix.type = 'text/javascript';
rScix.async = true;
rScix.src = ('https:' == document.location.protocol ? 'https://' : 'http://') + 'd1stxfv94hrhia.cloudfront.net/waves/v3/w.js';
(document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(rScix);
})();
</script>
Implement our Checkout Success Snippet in Advanced Settings
This step implements our conversion tracking pixel for a successful checkout, something we call a “Checkout Success” JavaScript event.
- Navigate to Advanced Settings > Web Analytics.
- In the Analytics Packages section, check "Affiliate Conversion Tracking," and then click Save to enable it.
- Click the Affiliate Conversion Tracking tab and locate the Conversion Tracking Code section.
- In the Conversion Tracking Code section, paste the code snippet below and ensure that you replace the
site_id
variable with your correctsite_id
value. Click Save when finished.
<!-- RetentionScience start -->
<script type="text/javascript">
window._rsq = window._rsq || [];
window._rsq.push(['_setSiteId', 'site_id']); // replace with your site_id
window._rsq.push(['_enableOnsite']);
window._rsq.push(['_setUserEmail','%%ORDER_EMAIL%%']);
/*** EVENT SPECIFIC CODE ***/
window._rsq.push(['_addOrder', { 'id':'%%ORDER_ID%%', 'total':'%%ORDER_AMOUNT%%' }]);
window._rsq.push(['_setAction', 'checkout_success']);
/*** END EVENT SPECIFIC CODE ***/
window._rsq.push(['_track']);
(function() {
var rScix = document.createElement('script');
rScix.type = 'text/javascript';
rScix.async = true;
rScix.src = ('https:' == document.location.protocol ? 'https://' : 'http://') + 'd1stxfv94hrhia.cloudfront.net/waves/v3/w.js';
(document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(rScix);
})();
</script>
<!-- RetentionScience end -->
That’s it! Once the above has been completed, your data will start syncing to ReSci. It typically takes 3 - 5 business days for our team to train our AI on the data you provided, complete a thorough QA process, and ensure that everything works end-to-end.
When everything is ready to go, your dedicated onboarding expert or client success manager will contact you to confirm that the integration is complete and you’re ready to launch your AI-powered email campaigns!
Looking for help setting up the BigCommerce Transactional Stage and emails? See our Setup Guide.
Comments
0 comments
Please sign in to leave a comment.