trackEvent( )


Sends a tracking event to external analytics tools.

The trackEvent() function sends an event to analytics tools connected to your site. It can send events to Google Analytics, Facebook Pixel or analytics tools set up with the Google Tag Manager.

Learn more about:

Note: The trackEvent() function only runs on published versions of your site. It doesn't work when previewing your site.

The trackEvent() function lets you track both standard and custom events.

The following standard events are supported:

Standard EventDescriptionUsed By
AddPaymentInfoWhen a site visitor saves payment information.Google Analytics, Facebook Pixel
AddProductImpressionWhen a site visitor views a product.Google Analytics
AddToCartWhen a site visitor adds a product to the shopping cart.Google Analytics, Facebook Pixel
CheckoutStepWhen a site visitor completes a checkout step.Google Analytics
ClickProductWhen a site visitor clicks on a product.Google Analytics
CompleteRegistrationWhen a site visitor completes the registration. Note: The CompleteRegistration event doesn't take any parameters.Facebook Pixel
InitiateCheckoutWhen a site visitor starts the checkout process.Google Analytics, Facebook Pixel
LeadWhen a site visitor subscribes to a newsletter or submits a contact form.Google Analytics, Facebook Pixel
PurchaseWhen the customer successfully completes the checkout process.Google Analytics, Facebook Pixel
RemoveFromCartWhen a site visitor removes a product from the shopping cart.Google Analytics
ScheduleWhen a site visitor schedules a meeting or makes an appointment. Note: The Schedule event doesn't take any parameters.Facebook Pixel
StartPaymentWhen a site visitor starts the payment process.Google Analytics
ViewContentWhen a site visitor views a key page, for example the product page.Google Analytics, Facebook Pixel
Method Declaration
Copy
Method Parameters
eventNamestringRequired

Event name. Applies to both standard and custom events. The following standard events are supported:

  • AddPaymentInfo
  • AddProductImpression
  • AddToCart
  • CheckoutStep
  • ClickProduct
  • CompleteRegistration
  • InitiateCheckout
  • Lead
  • Purchase
  • RemoveFromCart
  • Schedule
  • StartPayment
  • ViewContent

parameterstrackingParametersAddPaymentInfoEventRequired

The event's parameters. Note: The CompleteRegistration and Schedule events don't take any parameters.

Was this helpful?
Yes
No