Search...
trackEvent( )
Sends a tracking event to external analytics tools.
Description
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:
- Marketing Integrations
- Connecting a Facebook Pixel to Your Wix Site
- Connecting a Google Analytics Property to Your Wix Site
- Connecting Your Google Tag Manager Account to Your Wix Site
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 Event | Description | Used By |
---|---|---|
AddPaymentInfo | When a site visitor saves payment information. | Google Analytics , Facebook Pixel |
AddProductImpression | When a site visitor views a product. | Google Analytics |
AddToCart | When a site visitor adds a product to the shopping cart. | Google Analytics , Facebook Pixel |
CheckoutStep | When a site visitor completes a checkout step. | Google Analytics |
ClickProduct | When a site visitor clicks on a product. | Google Analytics |
CompleteRegistration | When a site visitor completes the registration. Note: The CompleteRegistration event doesn't take any parameters. | Facebook Pixel |
InitiateCheckout | When a site visitor starts the checkout process. | Google Analytics , Facebook Pixel |
Lead | When a site visitor subscribes to a newsletter or submits a contact form. | Google Analytics , Facebook Pixel |
Purchase | When the customer successfully completes the checkout process. | Google Analytics , Facebook Pixel |
RemoveFromCart | When a site visitor removes a product from the shopping cart. | Google Analytics |
Schedule | When a site visitor schedules a meeting or makes an appointment. Note: The Schedule event doesn't take any parameters. | Facebook Pixel |
StartPayment | When a site visitor starts the payment process. | Google Analytics |
ViewContent | When a site visitor views a key page, for example the product page. | Google Analytics , Facebook Pixel |
Authorization
Request
This endpoint does not take any parameters
Status/Error Codes
Was this helpful?
Send a standard event that doesn't take parameters
Copy Code
1import wixWindow from 'wix-window';23// ...45wixWindow.trackEvent("Lead");
Send a standard event with parameters
Copy Code
1import wixWindow from 'wix-window';23// ...45wixWindow.trackEvent("ViewContent", {6 origin: "My Sportswear Store",7 id: "P12345",8 sku: 20,9 name: "Really Fast Running Shoes",10 price: 120,11 currency: "USD",12 category: "Apparel/Shoes",13 brand: "SomeBrand",14 variant: "Black",15 list: "Product Gallery",16 position: 117} );
Send a custom event
Copy Code
1import wixWindow from 'wix-window';23// ...45wixWindow.trackEvent("CustomEvent", {6 eventCategory: "Sporting Goods",7 eventAction: "FrequentShopper",8 eventLabel: "November",9 eventValue: 1,10 purchase_count: 8,11 average_purchase_value: 245.24,12 currency: "USD",13 "shipping_info": {14 method: "standard overnight",15 note: "leave at the front door"16 }17} );