Skip to main content

Pixel Tracking

Learn how to add the AIQ tracking pixel to your website and track custom events to enhance your data sets and campaigns.

Updated yesterday

⚠️ Warning: 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 user 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 customer's info:

<script>aiq('customEventName', 'customEventValue');</script>

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 opt-in 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 opt-in 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

Product was put in a user's cart.

<script>
aiq('productAddedToCart', {
  cart_id: '1234',
  product_id: '222',
  sku: 'CBD_9028',
  category: 'Flower',
  name: 'OG Flower',
  brand: 'Aurora',
  unitPrice: 18.99,
  quantity: 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 the checkout flow has started (e.g. "Shipping info", "Coupon info").

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

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 arrived at the current page by clicking an email link.

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

Text link clicked

The user arrived at the 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 the user.

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

Video ended

A video the user was watching has finished playing.

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

Experiment viewed

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

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

Did this answer your question?