SMARTPOINT
SmartPoint integration ensures your ability to evaluate anonymous data regarding the behaviors of those people visiting your e-shop. This includes:
- Viewed products
- Login information and details
- Checkout process
- Cart interactions
- and more
So what is SmartPoint exactly?
- It’s a basic tracking script
- Provides information about visitors and customers
- Connects data from multiple devices thanks to a saved cookie
INTEGRATING SMARTPOINT
You have two general options for integrating SmartPoint:
- Direct Integration via the coding of your website/e-shop (i.e. into the header script)
- Google Tag Manager (GTM) – used for managing tracking codes and advertisement scripts
SMARTPOINT FUNCTIONS
customerLoggedIn()
- Provides information about the customer’s ID
- Makes it able to connect a customer to their shopping history
order()
- Provides information about a customer’s orders and the included items
- Sends a signal to Samba immediately after an order is finished
cartInteraction()
- Provides information about the content of a cart
- Makes it able to activate an Abandoned Cart trigger
productId() (Optional)
- Use this, in case product URLs in your feed are not consistent with active URLs on your website
- Not neccessary if you have SmartPoint tracking script implemented on your website
DIRECT INTEGRATION
If you want to add SmartPoint through direct integration, first go to your Samba panel and navigate to your settings (click the gear on the top right). From there, click “Implementation” and expand the “Customer tracking” options.
Click on the “SmartPoint” option and you’ll be presented with a tracking script (see example below) that you would need to add onto every page of your website. Again, an optimal means of doing this would be in the code of your header.
The standard form of the script looks like this:
<script async src="https://yottlyscript.com/script.js?tp=*YOUR-ID*"></script>
where *YOUR-ID*
is your unique track point ID.
VALIDATING DIRECT INTEGRATION
Open a console, go to Network – XHR and search for the save-action object.
If you integrated the SmartPoint correctly, the diffAnalytics
object should be availible. Write diffAnalytics into the console and press Enter.
Asynchonous integration
If you need to integrate the SmartPoint in the asynchronous way (in GTM for example), we recommend you to integrate all the other scripts via the onload queue.
var _yottlyOnload = _yottlyOnload || [] _yottlyOnload.push(function () { console.log("yottly je připraveno") })
It is essential to use only the push
method (no other way of array manipulation ), because after the script initialization, the _yottlyOnload
variable will be exchanged for an object with its own push
method, which immediately calls the callback function.
diffAnalytics.customerLoggedIn(customerId)
- customerId (string) – customer ID, which is the same as the ID in customers feed.
- call this function every time the customer is logged in. (with every pageload, not only with the first login)
- if the customer isnt logged in, dont call the method at all. Especialy do not call the methond with empty string or the default value (“undefined” for example), which would lead to wrong evaluation of customers data.
Example of calling customerLoggedIn
Customer with ID “1234” is logged in.
diffAnalytics.customerLoggedIn("1234")
Integration validation customerID
Open the console, go to Network. one of the requests save-action should contain customerId in „attachment“ after every pageload done by logged in customer.
Pay attentinton to the spelling – customerId must be in the same format as CUSTOMER_ID in the customers feed.
diffAnalytics.order(orderInfo)
- orderInfo =
{ content: orderItems }
- orderItems – array of bought products in format:
{ productId: "product-id-1", price: 20 }
- productId – must be the product ID from your products feed.
- price – current price of the product, or the sum of all the items with the same ID (tax included). For example one piece of “product-id-1” costs 1 dollar and the customer bought two pieces of this product, so the price is going to be 2 dollars.
This script helps Samba to analyse the performance fot the web personalization. This is why it’s important to call this method when an order is made (on the thank-you-page).
The number of “click-throughs” is measured automatically, if the URL adress of the product contains yottly_online.
Example of calling order
Customer bought one shampoo for 3 dollars, and two pieces of the same soap for 1,50 dollar a piece:
var content = [ { productId: "shampoo-1", price: 2 },
{ productId: "soap-1", price: 3 } ]
diffAnalytics.order({ content: content })
order integration validation
Open the console and go to Network. As soon as the customer finishes an order (and the thank-you-page is loaded), one of the save-action requests should contain orderSubmitted in attachment.
Pay attentinton to the spelling – productId muset be in the same format as product_ID in the product feed.
Interaction (cartContent)
- cartContent –
{ content: cartItems , onOrderPage:boolean}
- cartItems – array of products in the cart in format:
{ productId: "product-id-1", amount: 2 }
- productId – must be the product ID from your products feed
- amount – the number of pieces of the product in the cart
- onOrderPage – optional boolean indentificator, if the customer is in the process of finishing an order. If it’s not filled, Samba works with the false value.
This script helps Samba to analyse customer interaction with the shopping cart and is essential for the Abandoned cart trigger. That is why we recommend to call this method with every pageload (= on every single webpage). The contact array contains all products that are contained within the cart.
On the page, where customer finishes the order, call the method with parameter onOrderPage=true. This indentificator helps us to recognize pages, where the order is finished and potential redirect to payment gateway, etc.
When the customer finishes an order (on the thank-you-page), call the method with empty content: content=[]
(together with the order method).
Example of calling cartInteraction
Example 1
Customer has one shampoo and two pieces of the same soap in cart, and just got to the second step of the order process.
var content = [ { productId: "shampoo-1", amount: 1 },
{ productId: "soap-1", amount: 2 } ]
var onOrderPage = true diffAnalytics.cartInteraction({ content: content, onOrderPage: onOrderPage })
Example 2
Customer just finished an order:
var content = []
diffAnalytics.cartInteraction({ content: content})
cartInteraction integration validation
Open the console and go to Network. After the page loads, one of the save-action requests should contain cartInteraction in attachment.
Example 1
Customer loaded 2. step of order:
Example 2
The thank-you-page just loaded and customer finished an order.
Pay attentinton to the spelling – customerId must be in the same format as CUSTOMER_ID in the customers feed.
productId (optional)
Product tracking
In case product URLs in your feed are not consistent with active URLs on your website, product tracking needs to be implemented by calling the productId(productID)
method of the base diffAnalytics
object when a visitor visits the product detail with productID
as ID. It is not necessary to call this function if you have the SmartPoint implemented correctly and Yottly is able to recognize all products.
diffAnalytics.productId(productID)
- productID – string
- It is product ID which is compatible with Yottly product feed. The ID helps Yottly to pair the unknown products URL.
- Call this method whenever the customer visits the detail of a product.
Full example:
Customer visited product ID “a1234”.
diffAnalytics.productId("a1234")
Validate your implementation
Go to the browser console, select Network and one of the save-action requests should contain productId in the attachment when the customer visits the detail of a product. Please pay attention to correct spelling.
This post is also available in:
Čeština (Czech)