Reports an event in the live site to the user’s analytics tool, like Facebook Pixel or Google Analytics.
SDK Version: SDK 1.93.0+
Display: Live Site
Components: Widget, Pinned (aka Fixed-Position) Widget, Page, Worker
Syntax:
Parameters:
Name | Type | Description |
---|---|---|
eventName (required) | String | Name of the event, as specified in the list below.You can also define a custom event. |
params (required) | Object | Object with key/value pairs required to report this event |
Example:
Events
You can report the following events with trackEvent:
Important:
In these events we refer to “products”, but a product can be any important item the user is tracking, like a service, event, music track or album, etc.
Report this event when a visitor views a product or item.
Syntax:
Parameters:
Name | Type | Description |
---|---|---|
origin | String | Origin of the event (e.g. Music Player, Contact Form) |
contents (required) | Array[Objects] | Key/value pairs with more details about the product |
contents.id | String | Product ID |
contents.sku | String | SKU number for the product |
contents.name (required) | String | Name of the product |
contents.price | Number | Price of the product |
contents.currency | String | Currency code (e.g., EUR, USD, CAD) |
contents.category | String | Category the product is listed under (e.g., ‘Accessories/Watches’) |
contents.brand | String | Brand name of the product (e.g., ‘Nike’) |
contents.variant | String | Variant of the product (like a specific color or size) |
contents.list | String | List or collection the item is in (e.g., ‘Product Gallery’ or ‘Search Results’) |
contents.position | Number | Position of this item within a list or collection (e.g., 1) |
Example:
Report this event when a visitor clicks on a product or item.
Syntax:
Parameters:
Name | Type | Description |
---|---|---|
origin | String | Origin of the event (e.g. Music Player, Contact Form) |
id | String | Product ID |
sku | String | SKU number for this product |
name (required) | String | Name of the product |
price | Number | Price of the product |
currency | String | Currency code (e.g., EUR, USD, CAD) |
category | String | Category this product is listed under (e.g., ‘Accessories/Watches’) |
brand | String | Brand name of the product (e.g., ‘Nike’) |
variant | String | Variant of this product (like a specific color or size) |
list | String | List or collection the item is in (e.g., ‘Product Gallery’ or ‘Search Results’) |
position | Number | Position of this item within a list or collection (e.g., 1) |
Example:
Report this event when a visitor views a key page, like the product page.
Syntax:
Parameters:
Name | Type | Description |
---|---|---|
origin | String | Origin of the event (e.g. Music Player, Contact Form) |
id | String | Product ID |
sku | String | SKU number for this product |
name (required) | String | Name of the product |
price | Number | Price of the product |
currency | String | Currency code (e.g., EUR, USD, CAD) |
category | String | Category this product is listed under (e.g., ‘Accessories/Watches’) |
brand | String | Brand name of the product (e.g., ‘Nike’) |
variant | String | Variant of this product (like a specific color or size) |
list | String | List or collection the item is in (e.g., ‘Product Gallery’ or ‘Search Results’) |
position | Number | Position of this item within a list or collection (e.g., 1) |
Example:
Report this event when a visitor clicks a button to add a product to the shopping cart (e.g., when the Add to Cart button is clicked).
Syntax:
Parameters:
Name | Type | Description |
---|---|---|
origin | String | Origin of the event (e.g. Music Player, Contact Form) |
id | String | Product ID |
sku | String | SKU number for this product |
name (required) | String | Name of the product |
price | Number | Price of the product |
currency | String | Currency code (e.g., EUR, USD, CAD) |
category | String | Category this product is listed under (e.g., ‘Accessories/Watches’) |
brand | String | Brand name of the product (e.g., ‘Nike’) |
variant | String | Variant of this product (like a specific color or size) |
position | Number | Position of this item within a list or collection (e.g., 1) |
quantity | Number | Product quantity |
Example:
Report this event when a visitor clicks a button to remove a product from the shopping cart.
Syntax:
Parameters:
Name | Type | Description |
---|---|---|
origin | String | Origin of the event (e.g. Music Player, Contact Form) |
id | String | Product ID |
name (required) | String | Name of the product |
price | Number | Price of the product |
currency | String | Currency code (e.g., EUR, USD, CAD) |
category | String | Category this product is listed under (e.g., ‘Accessories/Watches’) |
brand | String | Brand name of the product (e.g., ‘Nike’) |
variant | String | Variant of this product (like a specific color or size) |
position | Number | Position of this item within a list or collection (e.g., 1) |
quantity | Number | Product quantity |
Example:
Report this event when a visitor clicks a button to begin the checkout process.
Syntax:
Parameters:
Name | Type | Description |
---|---|---|
origin | String | Origin of the event (e.g. Music Player, Contact Form) |
contents (required) | Array[Objects] | Key/value pairs with more details about the product |
contents.id | String | Product ID |
contents.sku | String | SKU number for the product |
contents.name (required) | String | Name of the product |
contents.price | Number | Price of the product |
contents.currency | String | Currency code (e.g., EUR, USD, CAD) |
contents.category | String | Category the product is listed under (e.g., ‘Accessories/Watches’) |
contents.brand | String | Brand name of the product (e.g., ‘Nike’) |
contents.variant | String | Variant of the product (like a specific color or size) |
contents.quantity | Number | Quantity of this specific product a visitor is purchasing |
Example:
Report this event when a visitor reaches a payment form, before making a purchase.
Syntax:
Parameters:
Name | Type | Description |
---|---|---|
origin | String | Origin of the event (e.g. Music Player, Contact Form) |
option | String | Payment type (e.g., 'Fast Checkout') |
Example:
Report this event when a visitor clicks a button to save payment info for a purchase.
Syntax:
Parameters:
Name | Type | Description |
---|---|---|
origin | String | Origin of the event (e.g. Music Player, Contact Form) |
option | String | Payment type (e.g., ‘Visa’ or ‘PayPal’) |
Example:
Report this event for any custom checkout interaction that a visitor completes between initiating a checkout and completing a purchase.
Syntax:
Parameters:
Name | Type | Description |
---|---|---|
origin | String | Origin of the event (e.g. ‘Music Player’, or ‘Contact Form’) |
step | String | Checkout flow step number. Make sure to report consistent step values (e.g. ‘3’ when step follows StartPayment and addPaymentInfo events) |
action | String | The action the visitor is taking in this step (e.g. ‘Select Shipping’) |
option | String | Payment type (e.g., ‘Express Shipping’) |
Example:
Report this event when a purchase is completed successfully.
Syntax:
Parameters:
Name | Type | Description |
---|---|---|
origin | String | Origin of the event (e.g. Music Player, Contact Form) |
id (required) | String | Transaction ID or order number |
affiliation | String | Name of the store |
revenue | String | Total amount for this purchase, including taxes, shipping, etc. (e.g., ‘5.99’) |
tax | String | Total amount charged in taxes (e.g., ‘5.99’) |
shipping | String | Total amount charged for shipping (e.g., ‘5.99’) |
coupon | String | Coupon code applied to this purchase |
contents (required) | Array[Objects] | Array of all product objects related to this purchase |
contents.id | String | Product ID |
contents.name (required) | String | Name of the product |
contents.price | Number | Price of the product |
contents.currency | String | Currency code (e.g., EUR, USD, CAD) |
contents.category | String | Category the product is listed under (e.g., ‘Accessories/Watches’) |
contents.brand | String | Brand name of the product (e.g., ‘Nike’) |
contents.variant | String | Variant of the product (like a specific color or size) |
contents.quantity | Number | Quantity of this specific product a visitor is purchasing |
Example:
Report this event when a visitor subscribes to a newsletter or submits a contact form.
Example:
Report a custom event that doesn’t fit any of the standard events listed above.
Syntax:
Parameters:
Name | Type | Description |
---|---|---|
event (required) | String | Name of the event |
param | Custom | Name of the parameter |
Example:
SDK Version: Deprecated
Important:
Now that this method is deprecated, use trackEvent instead.
Reports an event that happened in your app on the live site. The event is sent to all registered pixels on the site – even pixels used in other apps.
Parameters:
Name | Type | Description |
---|---|---|
PixelEventType (required) | Wix.Analytics.PixelEventType.[EVENT].eventName | The event you are reporting. You can see the event descriptions in Facebook’s Pixel API. To make sure that the event matches Facebook’s API, enter the event name in this format: Wix.Analytics.PixelEventType.[EVENT].eventName, where [EVENT] is one of the following: VIEW_CONTENT, SEARCH, ADD_TO_CART, ADD_TO_WISHLIST, INITIATE_CHECKOUT, ADD_PAYMENT_INFO, PURCHASE, LEAD, COMPLETE_REGISTRATION, CUSTOM_EVENT. For example, Wix.Analytics.PixelEventType.PURCHASE.eventName returns the correct event name - ‘Purchase’. |
data | Object | Enter the event parameters. To get a list of required and optional parameters for an event, use this method: Wix.Analytics.PixelEventType.[EVENT]. For more information, see Facebook’s Pixel API. |
Example:
SDK Version: Deprecated
Registers and initializes the Facebook pixel on the live site. The pixel registration is saved for this session only, so call this method every time your app loads in the live site.
Parameters:
Name | Type | Description |
---|---|---|
pixelType (required) | PixelType | Enter Wix.Analytics.PixelType.FACEBOOK here |
pixelId (required) | String | A unique pixel identifier that was predefined by Facebook and is associated with a Facebook Ad account |
Example: