Analyze User Behavior Using Embedded Scripts

This article explains how to use embedded scripts for analytics. You can:

Listen to predefined Wix events

Wix offers the predefined events listed in the Client reference documentation. For example:

  • addProductImpression: When a user views a product. 
  • clickProduct: When a user clicks on a product.
  • viewContent: When a key page is viewed.
  • addToCart: When a user adds a product to the shopping cart.
  • removeFromCart: When a user removes a product from the shopping cart. 
  • initiateCheckout: When a user starts the checkout process.
  • startPayment: When a user starts the payment process.
  • addPaymentInfo: When a user saves payment information.
  • checkoutStep: When a user completes a custom checkout step. 
  • purchase: When the checkout process is complete.
  • lead: When a user subscribes to a newsletter or submits a contact form.

To listen to an event, add the following code to your embedded script using your selected event:

Copy

Note: Replace 'APP_ID' with your own unique app ID found on the OAuth page of your app's dashboard.

Report and listen to custom events

To report and listen to a custom event, you need to define the event name and event data. Then, register the event:

Copy

Note: Replace 'APP_ID' with your app's unique ID found on the OAuth page of your app's dashboard.

We recommend that you listen to the wixDevelopersAnalyticsReady event to ensure that your script doesn't call the SDK before it's fully initialized:

Copy

The returned data varies based on the specific event, but always includes the following:

  • isPremium: true if the site owner has a premium plan, and false if they have a free plan.
  • uuid: The unique ID of the site owner in Wix.
  • msid: The unique ID of the Wix site.
Did this help?