A prerequisite to track web events is to install the SendGrid pixel and identify your site visitors. 

Events are actions that happen on your website (e.g. Signed Up for Email List  or Purchase). Tracking these events along with the users performing them will enable SendGrid to better engage on your behalf with email and advertising. To track events related to your users we'll need to pass event details as well as information about the user performing the event.

SendGrid currently supports the following two events types:

  1. Purchase Completed
  2. Lead Generated

Purchase Completed

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

It's recommended you supply the order and product specific properties with the Purchase event.

Example (recommended): 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'

    }

  ]

});


Example (minimal):
Contains the minimum required for the purchase event

sendgrid.track('Purchase');

Lead event

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

Example (recommended): Contains all available lead event properties supported

sendgrid.track('Lead Captured', {

  email: 'mike@example.com',

  source: 'Landing Page 1'

});

Example (minimal): Contains the minimum required for the lead event

sendgrid.track('Lead Captured', {

  email: 'mike@example.com'

});
Did this answer your question?