Common use cases

Pixel Tracking

5min

Enhance your data sets, enrich your campaigns across tools, and make clearer business decisions. To track events via your website, you will need to place a javascript pixel on the pages you wish to track interactions.

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.

How to Add the Pixel to your Website

  1. Navigate to Settings > API & Tracking and locate the tracking pixel code.
  2. Copy the entire code snippet.
  3. Place the code into your website header. Placing pixel tracking code on your website depends on the platform you're using. Here's some common ones:
    • WordPress: Go to Appearance > Theme Editor, locate the header.php file of your active theme and paste the pixel code just before the closing <head> tag.
    • Webflow: Go to Project Settings > Custom Code. Under the Head Code section, paste the pixel code.
    • Wix: Navigate to Settings > Custom Code. Click + Add Custom Code. Paste the pixel code. Choose Header under the placement settings. Set it to load on all pages (or specific ones as needed).
  4. Publish your site.
    • At this point your pixel will be tracking users page views and AIQ will attempt to resolve identities in your data infrastructure.

How to Track Events via the Pixel

To enable more complex and insightful use cases, we track events as they happen. For example, you can notify AIQ when a user adds to their cart, watches a product video, or starts a live chat. Track almost any event and segment on it later using the schema below.

Note: The following is not needed if you are only using the pixel for the popup version of the signup form.

  1. Navigate to Settings > Integrations > Website JS and click connect.
  2. Save the integration.
  3. To track a custom event you can call “aiq” after the required code above anywhere on the page. The example below illustrates creating and 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 loyalty 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 protected]', mobilePhone: '9708399900', firstName: 'Jason', lastName: 'Bourne' birthdate: 1576274448, signedUp: 1576274448, ageGate: true, favoriteStore: "XYZ", smsoptin: false, loyalty: true, addr: {"city": "Somerville", "state":"MA", "street":"44 Green Street", "country": "USA", zipCode":"02143"},

"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>