Tracking users to page views, purchase events and leads with the SendGrid Pixel

Ads is currently in closed beta. During beta, only approved participants have access to the feature. Functionality and performance might not be working quite like we want it to and we reserve the right to change the functionality at any time without warning. For more information on the Ads beta, or to join the beta waitlist, see our Ads Solution Page.

To optimize your view into your campaign analytics, we highly recommend that you take the time to install the Twilio SendGrid Pixel. This will give you the ability to associate users with website activity, purchase events, and lead activities. You can also use this data to send targeted campaigns to your known users based on specific events.

Track users to Page Views

Page views are automatically recorded by the pixel. You’ll need to associate page views to the identified user by implementing the Identity Call (see steps above). This association will allow you to send targeted campaigns to users based on page view activity. For example, when a user visits your pricing page you can automatically retarget this user with an advertisement.

The call is already included in the Twilio SendGrid pixel. We will automatically record the following with zero configuration needed from you.'Pricing and Plans | SendGrid', {
  title: 'Pricing and Plans | SendGrid',
  url: '',
  path: '/pricing',
  referrer: ''

Track users to website activity with an Identity Call

With this association in place, you can create campaigns that target users visiting a specific web page or performing a specific event such as a purchase. On all pages where your Twilio SendGrid pixel is installed and you know your users’ identity, you will include an Identity Call and pass a unique id and the email address of the user.

Here is what the code for an Identity Call looks like:

sendgrid.identify([userId], [traits]);
Here is an example of an Identity Call:
sendgrid.identify('123456', {
  email: ''

Track users to Purchase Events on your website

Purchase event can be tracked when a customer completes the purchase of a product or service from your business.

Property Type Description
total Number The total value of the order
currency String Three letter currency code for the order
products Array List of products in order
product_id String A unique ID for the product
name String Name of the product
sku String Stock Keeping Unit (SKU) for the product
price Number Price of the individual product
quantity Number Quantity purchased of the product
category String Category of the product

It is recommended you supply the order and product-specific properties with the Purchase event. Here is an example that contains all available purchase event properties supported:

sendgrid.track('Purchase Completed', {
  total: 119.85,
  currency: 'USD',
  products: [
      product_id: '1',
      name: 'Essentials Plan',
      sku: 'SKU-1',
      price: 19.95,
      quantity: 2,
      category: 'Transactional Email'
      product_id: '2',
      name: 'Pro Plan',
      sku: 'SKU-2',
      price: 79.95,
      quantity: 1,
      category: 'Marketing Email'

This is an example of that contains the minimum required for the purchase event:


Track users to specific Lead events

A Lead event should be tracked when you first capture a new email address on your website. This is considered as a new lead.

Property Type Description
email String Email address of lead captured
source String The source from which lead was captured

Below is an example that contains all the available lead events properties support. We recommend including the source so that you know where your leads are getting generated.

sendgrid.track('Lead Captured', {
  email: '',
  source: 'Landing Page 1'

Here is an example that contains the minimum required for the lead event:

sendgrid.track('Lead Captured', {
  email: ''

Additional Resources

See a mistake? Edit this page