Skip to main content

Tracking Shopify Leads with TrackBee

Send lead events from your Shopify store to Meta, Google, Pinterest and TikTok through TrackBee using a small code snippet.

Written by Pico

This guide explains how to send lead events from your Shopify store to your connected ad platforms using TrackBee. Once set up, every time a visitor submits a lead form on your store, TrackBee will forward that event to Meta, Google, Pinterest and TikTok so you can track and optimise for leads directly inside your ad accounts.

Heads up: This setup requires adding a small piece of code to your Shopify store. If you are not comfortable editing code, please contact your Shopify developer or reach out to our support team via the chat widget in the bottom right corner, we are happy to help.


What this integration does

When a visitor submits a lead form on your store, TrackBee picks up that event and forwards it to your connected ad platforms:

  • Meta - sends a Lead event via the Conversions API

  • Google Ads - creates a new conversion action for leads

  • TikTok - sends a Lead event via the Events API

  • Pinterest - sends a Lead event via the Conversions API

This means you can optimise your ad campaigns for actual leads rather than just page views or clicks.


How it works

TrackBee provides a small JavaScript snippet that you call at the exact moment a lead is captured on your store. Where exactly that moment is depends on how your store collects leads. Common examples include:

  • A pop-up or modal β€” a form that appears over the page asking for an email address or phone number

  • A contact form - a dedicated page where visitors can send a message or request

Because every store is set up differently, the exact location in the code where you place the snippet will vary. Your Shopify developer will know the right place.


The tracking snippet

Copy the snippet below and place it so that it runs at the moment a visitor successfully submits your lead form. Replace the placeholder values with the actual data from the form submission.

At least one of email, phone, firstName, or lastName must be provided. If none are supplied, the event will not be tracked and an error will be logged.

// Send a TrackBee lead event. At least one of email, phone, firstName, lastName should be sent, otherwise the event will not be tracked and an error will be logged.
window?.TrackBee?.track_lead({
source: 'NewsLetter', // Required. This string can contain anything. Use a term most descriptive of your lead gathering method.
email: '[email protected]', // Optional. This string should contain the email address if one was supplied in the form.
phone: '+31612345678', // Optional. This string should contain the phone number if one was supplied in the form.
firstName: 'John', // Optional. This string should contain the first name if one was supplied in the form.
lastName: 'Doe', // Optional. This string should contain the last name if one was supplied in the form.
});

A minimal example with only the required field and an email address looks like this:

window?.TrackBee?.track_lead({
source: 'NewsLetter',
email: '[email protected]',
phone: '+31612345678',
firstName: 'John',
lastName: 'Doe',
});


Need help?

If you are not sure where to place the snippet, or if something is not working as expected, reach out to us via the chat widget in the bottom right corner. You can also share the guide with your Shopify developer β€” they should be able to place the code in the right spot quickly.

Did this answer your question?