Setting Up Your Store's Data with Searchspring:
1. Prepare | » | 2. Connect | » | 3. Fields | » | 4. Settings | » | 5. IntelliSuggest | » | 6. Analytics |
This article describes the process for setting up IntelliSuggest page tracking.
The instructions that follow are meant to be a generic guideline, suitable to be translated into any E-Commerce Platform. For our platform-specific instructions, see one of the following articles:
- 3dcart
- BigCommerce Blueprint
- BigCommerce Stencil
- CommerceV3
- Magento 1
- Magento 2
- MIVA
- Shopify
- Volusion
If your cart isn't listed above, please continue to follow the instructions below. Be sure to replace the placeholder examples with the appropriate values (e.g., "YOUR_SITE_ID")
Your Searchspring Account Site ID may be found under "My Account" in the top right of the Searchspring Management Console.
User ID and Shopper ID
IntelliSuggest automatically tracks the user ID as the cookie-generated ssUserId when the shopper is not logged in. API customers need to set tracking cookies for userId while all other integrations have that functionality baked into IntelliSuggest.
Shopper ID must be passed through a setShopperId command. In the event that the shopper is not logged in, an empty shopper ID is passed.
Product Views (Product Detail Page)
Placing the script just before the closing </body>
tag works best for user experience/performance.
The SKU argument to the viewItem() should be the unique product SKU that is used in the SKU core field. This may be referenced in your product catalog as a part number or product code for that item.
The SKU passed here should be the same field as the SKU from your Core Fields setup. If you change the SKU field in Core Fields or in this tracking, be sure to also change both to match. Failure to do so can result in Product Recommendations and Product Insights features breaking for your site.
<script type="text/javascript" src="//cdn.searchspring.net/intellisuggest/is.min.js"></script>
<script type="text/javascript">
try{
var product_code = "SS_SKU_CORE_FIELD";
IntelliSuggest.init({siteId:'YOUR_SITE_ID', context:'Product/' + product_code, seed:[product_code]});
IntelliSuggest.setShopperId('THE_SHOPPER_ID');
IntelliSuggest.viewItem({sku:product_code});
} catch(err) {}
</script>
Basket Contents (Basket or Cart Page)
Placing the script just before the closing </body>
tag works best for user experience/performance.
One or more haveItem() calls are allowed. Include a haveItem() call for each item the shopper currently has in their basket. Don't worry about figuring out what they have most recently added or removed - always include all of the items currently in the basket.
The SKUs tracked on your Basket Contents page should match the SKU core field tracked on the Product View page.
Tracking Child SKUs / Variants
childSku can be passed in addition to sku for better tracking and performance of other Searchspring features. If you pass only childSku, the event will be included for Personalized Recommendations, but completely ignored for Searchspring reports and other features.<script type="text/javascript" src="//cdn.searchspring.net/intellisuggest/is.min.js"></script>
<script type="text/javascript">
try{
IntelliSuggest.init({siteId:'YOUR_SITE_ID', context:'Basket', seed:['ABC123','1000C','8ZYX300']});
IntelliSuggest.setShopperId('THE_SHOPPER_ID');
// Loop through products in cart
IntelliSuggest.haveItem({sku:"ABC123", qty:"1", price:"107.95"});
IntelliSuggest.haveItem({sku:"1000C", childSku:"400-XYZ", qty:"1", price:"20.00"});
IntelliSuggest.haveItem({sku:"8ZYX300", qty:"1", price:"7.63"});
IntelliSuggest.setCurrency({ code: 'USD' });
// Code should indicate country currency code
IntelliSuggest.inBasket({});
} catch(err) {}
</script>
Sale (Order Confirmation Page)
Placing the script just before the closing </body>
tag works best for user experience/performance.
The inSale() information arguments are all optional.
The SKUs tracked on your Order Contents page should match the SKU tracked on the Product View page. In most cases, this would be the parent product SKU.
Tracking Child SKUs / Variants
childSku can be passed in addition to sku for better tracking and performance of other Searchspring features. If you pass only childSku, the event will be included for Personalized Recommendations, but completely ignored for Searchspring reports and other features.<script type="text/javascript" src="//cdn.searchspring.net/intellisuggest/is.min.js"></script>
<script type="text/javascript">
try{
IntelliSuggest.init({siteId:"YOUR_SITE_ID"});
IntelliSuggest.setShopperId('THE_SHOPPER_ID');
IntelliSuggest.haveItem({sku:"10-GRB7", qty:"3", price:"5.00"});
IntelliSuggest.haveItem({sku:"400XYZ", childSku:"400-XYZ", qty:"1", price:"10.00"});
IntelliSuggest.setCurrency({ code: 'USD' });
/* Code should indicate country currency code */
IntelliSuggest.inSale({
orderId:"1234", // The Order ID (optional)
total:"30.00", // The total order amount (optional)
city:"Los Angeles", // Customer"s shipping address City (optional)
state:"CA", // Customer"s shipping address State (optional)
country:"US" // Customer"s shipping address 2-letter Country Code (optional)
});
} catch (e) {}
</script>
Product Clicks (Category, Brand and Search Results Pages)
If you are integrating via our API you will also need to track product clicks on the search results page and autocomplete. This is not required if integrating via our JavaScript Catalog.
These Product Click Tracking events are only relevant to those completing their own custom integration via Searchspring's RESTful API - Searchspring's AJAX-based integration will include Product Click tracking within our item templates.
If you're using the Searchspring API with the native response format, you'll need to handle search and navigation result page click tracking in your result templates. The simplest way to do this is by leveraging the IntelliSuggest.clickItem()
method within Intellisuggest tracking script. This requires having the script loaded where it is being used.<script type="text/javascript" src="//cdn.searchspring.net/intellisuggest/is.min.js"></script>
To add tracking to product clicks, add the following function call to onMouseDown events on your product links, add to cart buttons, etc. for each product being rendered. Alternatively, you could place the event on the main product element.
onmousedown="IntelliSuggest.clickItem(this, { siteId: 'YOUR_SITE_ID' intellisuggestData, intellisuggestSignature })"
Be sure to set the proper Searchspring Site ID (replace 'YOUR_SITE_ID'). The intellisuggestData
and intellisuggestSignature
values correspond to attributes found within the Searchspring API response (for each product).
Manually via track.json
Sending events manually via our track.json
endpoint has been deprecated, and the instructions for this method have been removed. Please use the above instructions for tracking product clicks using the Intellisuggest tracking script instead.
Comments
4 comments
On the example for the Basket Page, should the "seed" value be a list of your product SKUs, separated by spaces?
Mike,
Yes.
James
Please note: I've updated this guide to load the IntelliSuggest JavaScript (is.min.js) via the SearchSpring CDN URL. This removes the need for a document.write() that conditionally loads a version for HTTP vs HTTPS pages.
Hi,
For Product Click custom integration, where can I find intellisuggestSignature and intellisuggestSignature values?
Am not seeing these values in any Searchspring API response.
Please sign in to leave a comment.