We’re excited to announce that you can now send events to Google Analytics and Facebook Pixel using the new trackEvent() function. Stay tuned for future announcements about supporting additional analytics apps.
How it works
-
Connect your site to your 3rd party analytics account as described here .
-
Call the trackEvent() function to send event data to the supported analytics apps that your site is connected to.
Events
You can send the following events or create your own custom event:
-
ViewContent
-
AddProductImpression
-
ClickProduct
-
AddToCart
-
RemoveFromCart
-
InitiateCheckout
-
AddPaymentInfo
-
Purchase
-
Lead
Note, that although the events refer to “products”, any important item you want to track can be considered a “product”.
Example
In the following example, we demonstrate how to send an AddProductImpression event when one of your users views a product on your site:
import wixWindow from 'wix-window';
//...
wixWindow.trackEvent("AddProductImpression", {
contents: [{
sku: "P12345",
name: "Really Fast Running Shoes",
category: "Apparel/Shoes",
price: 100,
currency: "USD",
brand: "Nike",
variant: "Black",
list: "Search Results",
position: 1
}]
});
Learn more
To learn more about sending analytics events, see the trackEvent() function in the API Reference.