Revenue attribution guide

Attribute revenue with Polar (other methods)

If you're using Polar Checkout API, follow this guide instead. If you're using Polar Checkout Links, follow this guide instead. Make sure you've connected your Polar account first.

Use the JavaScript snippet below to track revenue after successful payment by passing the customer's email:

// Track revenue after successful payment using email
window.datafast("payment", { email: "customer@example.com" });

Pass the actual email of the customer to the payment event.

Example implementation

Let's say your customers are redirected to a /welcome page after completing a checkout. You want to fire the DataFast payment event on this page. Using React, you can do this like this:

"use client"

import { useEffect } from 'react';

export default function Dashboard({ user }) {

  useEffect(() => {
    window.datafast("payment", { email: user.email });
  }, [user]);

  return (
    <div>
      <h1>Welcome to the app!</h1>
    </div>
  );
}

When to use this method

  • Third-party payment processors that use Polar
  • Mobile app payments

Important notes

  • Duplicate payment events are ignored so you don't need to worry about sending multiple events for the same payment
  • Works with any payment flow as long as you have the customer's email

After receiving a successful payment, you should see revenue data in your dashboard (referrer, country, browser, etc.). If you don't, please contact us at marc@datafa.st.

Something missing? Suggest features ✍️