A prerequisite to tracking users page views and purchases is to install the SendGrid pixel. Visit this article for instructions on how to install the SendGrid pixel.

Identifying your users with the SendGrid pixel

Here is where the magic happens. Once the SendGrid pixel is installed on your website the next step is to identify users in the script. This allows SendGrid to associate website activity such as page views and purchases with a known user of yours. 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 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.

Identify call

sendgrid.identify([userId], [traits]);


sendgrid.identify('123456', {

  email: 'mike@example.com'


Tracking page views with the SendGrid pixel

Page views are automatically recorded by the pixel. If you've also implemented the identify call we'll associate page views to the identified user. 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 sendgrid.page() call is already included in the SendGrid pixel. We will automatically record the following with zero configuration needed from you.

Ex: User visits https://sendgrid.com/pricing we will automatically track the following

sendgrid.page('Pricing and Plans | SendGrid', {

  title: 'Pricing and Plans | SendGrid',

  url: 'https://sendgrid.com/pricing',

  path: '/pricing',

  referrer: 'https://sendgrid.com/labs'


If you'd like to customize or override page tracking information you may do so here.

Tracking Purchase events with the SendGrid pixel

Tracking events is an important step to understanding how your users interact with your business. In addition, these events can be used to engage with your users with the right message at the right time.

To track purchase events, please see this article.

Did this answer your question?