Wishi partner widget/SDK documentation
  • The Formal Stuff
    • Introduction
    • iOS SDK
      • Setup
        • View controller setup example
      • Public protocols
      • Public API's
      • Data structures/types
    • Web SDK
      • Setup
      • Initialization
      • Data structures
      • Public API's/interfaces
      • Events subscription
      • Telemetry
    • Pixel
      • Set up the base code
      • Set up events
      • Tracking parameters
    • Client-side authentication
    • FAQ
Powered by GitBook
On this page

Was this helpful?

  1. The Formal Stuff
  2. Pixel

Set up events

Set up events on your website to measure the actions like making a purchase.

All events are tracked by calling the Pixel's wishiPixel(event, data) function, with the event name, and a JSON object as its parameters. For example, here's a function call to track when a visitor has viewed a product page:

window.wishiPixel('ProductViewed', {
  partnerUserId: "123-123",
  products: [
    {
      id: "1",
      name: "Name",
      buyUrl: "https://...",
      imageUrl: "https: //...",
      brand: "A name",
      price: 123.99,
      currency: "USD"
    }
  ]
});

You can call the wishiPixel(event, data) function anywhere between your web page's opening and closing <body> tags, either when the page loads, or when a visitor completes an action, such as clicking a button.

For example, if you wanted to track a standard purchase event after a visitor has completed the purchase, you could call the wishiPixel('CheckoutCompleted', data) function on your purchase confirmation page, like this:

<body>
  ...
  <script>
    wishiPixel('CheckoutCompleted', {data});
  </script>
  ...
</body>

If instead you wanted to track the same event when the visitor clicks a purchase button, you could tie the wishiPixel('CheckoutCompleted', data) function call to the purchase button on your checkout page, like this:

<button id="buyButton">Purchase</button>
<script type="text/javascript">
  $('#buyButton').click(function() {
    wishiPixel('CheckoutCompleted', {data});
  });
</script>

Note that the example above uses jQuery to trigger the function call, but you could trigger the function call using any method you wish.

PreviousSet up the base codeNextTracking parameters

Last updated 1 year ago

Was this helpful?