OptinMonster

How to integrate with OptinMonster to track revenue from checkouts

What is OptinMonster?

OptinMonster is a conversion optimization tool to capture leads and maximize sales.

Integrating Checkout Page with OptinMonster tracking script can help you track your revenue in OptinMonster.

For OptinMonster integration, there is no setup needed within Checkout Page. All setup is done on your own site, where you have embedded your checkout or added the pop-up checkout to.

The OptinMonster tracking script uses Checkout Page's callback event to track the revenue as Click or View in OptinMonster.

How do I add OptinMonster to my site?

  1. There are three ways to set it up:
  2. On your site, add the OptinMonster script to any page you want to trigger the OptinMonster campaign.
  3. On your site, add the OptinMonster script to the pages where you’re using the checkout embed or pop-up.
  4. On your site, add the following Checkout Page script to the pages where you’re using the checkout embed or pop-up and want to track revenue. ^
  <script type="text/javascript">
  window.addEventListener("message", function (event) {
    // check if event is from Checkout Page
    if (event.data.type && event.data.type === "checkoutpage.event") {
      // check if event is checkout event
      if (event.data.payload.event !== "checkout") return;

      const { value, currency, orderId } = event.data.payload;

      // track sale event in OptinMonster
      !(function (o, a) {
        var n;
        ((n = window)._omq = n._omq || []).push([o, a]);
      })("sale", {
        value: event.data.payload.value,
        currency: event.data.payload.currency.toUpperCase(),
        transaction_id: event.data.payload.orderId,
        test: false,
      });
    }
  });
</script>

On this page