7min

Tracking retail site visitor engagement

Enhance your data sets, enrich your campaigns across tools, and make clearer business decisions. Please note: Our privacy policy and applicable terms requires you to refrain from sending us sensitive personal information about your users, including but not limited to social security numbers and credit card details.

To track events via your website you will need to place a javascript pixel on the pages you wish to track interactions.

The following code is required: 1.) Place the code below into your website header ONLY. It will not slow your site down or cause problems with your pages.

JS
|

2.) Make sure to replace the “{{uid}}” placeholder in the code below with your actual Alpine IQ account identifier. The URL should read something like: https://lab.alpineiq.com/p/123.js when you are finished. At this point your pixel should be tracking users page views and our system will attempt to resolve identities in your data infrastructure. 3.) Turn on the "Website JS" integration on the "Connect Data" page in Alpine IQ.

Data Source
Data Source



Tracking events (*optional): In order to enhance your data sets to allow more complex and insightful use cases, we must track events as they occur. For example you might want to tell Alpine when a user adds something to their cart, when they watch a video on a product detail page, or when they perform a live chat with a support representative. You can tell us virtually any event and segment on it later using the schema below.

  1. ) To track a custom event you can call “aiq” after the required code above anywhere on the page. The example below illustrates creating/ updating a customers info:
JSON
|

Custom events: Event names will be available for use in your accounts audience builder after we have seen at least 1 in production.

Commonly recognized events: The following events are commonly used and therefore documented for your internal setup. Please note that we always track pages viewed so it is easy to segment audiences by page categories, brands viewed, products viewed, etc.



Event

Description

Code Example

Contact

Sends contact record info into personas. Fields are optional. Build your forms as you please. !!! WARNING !!! Passing mobilePhone with smsoptin: false, means that you want us to send that user an SMS asking to confirm their optin to your member club program. If you do not want this functionality, DO NOT pass the phone number. Additionally, only send smsoptin: true if you are certain a user is already part of your club and you do not want them to get the optin confirmation message! 

<script? aiq('contact', { email: 'email@email.com', mobilePhone: '9708399900', firstName: 'Nicholas', lastName: 'Musk' birthdate: 1576274448, signedUp: 1576274448, ageGate: true, favoriteStore: "XYZ", smsoptin: false, loyalty: true, addr: {"city": "dallas", "state":"TX", "street":"343 Browning Street", "country": "USA", zipCode":"76008"},

"customAttributes": [{

"key": "testKey",

"value": "testValue"

}],

"tosconsent": 1576274448 }); </script>

Site search

User searched your site.

<script> aiq('siteSearch', 'The query they searched'); </script>

Cart viewed

User viewed your cart

<script> aiq('cartViewed','1'); </script>

Product added to cart

Prodcut was put in a users cart.

<script> aiq('productAddedToCart', { cart_id: '1234' product_id: '222', sku: 'CBD_9028', category: 'Flower', name: 'OG Flower', brand: 'Aurora', unitPrice: 18.99, quanitity: 1, coupon: '420Sale', position: 3, url: 'https://yoursite.products/path', image_url: 'https://yoursite.com/images/ product.jpg' }) ; </script>

Product removed from cart

Product was removed from cart.

<script> aiq('productRemovedFromCart', { cart_id: '1234' product_id: '222', }) ; </script>

Checkout started

Checkout flow has started

<script> aiq('checkoutStarted', '1'); </script>

Checkout step viewed

A new step of checkout flow has started i.e. "Shipping info", "Coupon info" etc.

<script> aiq('checkoutStepViewed' ,'2'); </script>





Event

Description

Code example

Order completed

an order was completed. You can pass the items in the order and other detailed information.

<script> aiq('orderCompleted', { orderID: 'pine12394', totalPrice: 27.50, totalCost: 27.50, totalTax: 2, discount: 2.5, coupon: 'giftCardCode', currency: 'USD', products: [ { sku: 'IQ12394', name: 'Monopoly, 3rd Edition', price: 19, quantity: 1, category: 'Flower', url: 'https://yoursite.com/products/path', image_url: 'https://yoursite.com/images/ product.jpg' }, ] }); </script>

Email link clicked

The user has arrived at current page by clicking email link.

<script> aiq('emailLinkClicked', 'https://mylink.com'); </script>

Text link clicked

The user has arrived at current page by clicking a text link.

<script> aiq('textLinkClicked', 'https://mylink.com'); </script>

Live chat convo started

Live chat conversation has started

<script> aiq('liveChatStarted', '1'); </script>

Live chat convo ended

Live chat conversation has ended

<script> aiq('liveChatEnded', '1'); </script>

Live chat message sent

Your live chat agent has sent a message.

<script> aiq('liveMessageSent', 'Body of message'); </script>

Live chat message received

Your live chat agent has received a message.

<script> aiq('liveMessageReceived', 'Body of message'); </script>

Video started

a video has been started by user.

<script> aiq('videoStarted', {name: 'my video', timestamp: '157627448'}); </script>

Video ended

a video a user has

been watching has finished playing.

<script> aiq('videoEnded', {name: 'my video', timestamp: '157627448'}); </script>

Experiment viewed

A/B testing experiment has been viewed. You can use this to arrtibute performance.

<script> aiq('experimentViewed', {experimentID: '324', experimentName: 'my experiment', variationID: '123', variantName: 'variation name'}); </script>