Refficks

Clerk affiliate tracking with Refficks

New accounts in your app's Clerk sign-up, tied to the partner whose link brought them, so their later payment is credited to that partner.

Nobody has walked these steps against a real Clerk setup yet. They are built from the provider's documentation, listed at the bottom of this page.

What it gives you

  • Somebody who arrives through a partner's link and then creates an account in your app is tied to that partner. When they later pay, through any payment connection Refficks receives, the sale is credited to the partner who sent them.
  • A referral programme that rewards "they create an account" counts it.

What it does not

  • Only new accounts are named, never every sign-in: somebody who signed up before following a partner's link would otherwise read as an account that partner brought.
  • A partner is paid when that person pays, and the payment has to reach Refficks from a connection that names the same email.
  • A visitor who has not accepted cookies, or whose browser sends Global Privacy Control, is not named.

Steps

These are the steps as they read inside Refficks. Where one says “below”, it means this guide's page in Refficks, where your own script, addresses and checks are.

  1. 1. Put the Refficks script on every page

    Paste the snippet into the head of every page of your app, in its main layout. It records the partner's click when somebody arrives.

    Your copy of the Refficks script, with your own key in it, is on the Integrations page in Refficks.

  2. 2. Send new accounts to a welcome page

    Add this to your environment, so Clerk sends somebody to /welcome right after they create an account. A sign-in still goes where it goes now. If you set it on the component instead, it is signUpForceRedirectUrl="/welcome" on <SignUp>.

    NEXT_PUBLIC_CLERK_SIGN_UP_FORCE_REDIRECT_URL=/welcome
  3. 3. Name them on the welcome page

    Make app/welcome/page.jsx (or your welcome route) like this. Outside Next.js, useUser comes from @clerk/clerk-react instead.

    "use client";
    import { useEffect } from "react";
    import { useUser } from "@clerk/nextjs";
    
    export default function Welcome() {
      const { isLoaded, user } = useUser();
    
      useEffect(() => {
        if (!isLoaded || !user) return;
        (function say(tries) {
          if (!window.refficks) return tries < 40 && setTimeout(() => say(tries + 1), 250);
          window.refficks.identify({ email: user.primaryEmailAddress?.emailAddress, external_id: user.id });
        })(0);
      }, [isLoaded, user]);
    
      // Then send them on, as your sign-up does now.
      return <p>Welcome! Setting up your account…</p>;
    }
  4. 4. Try it

    Open your app through any partner's link, copied from their page under Partners, and create an account. The checks on this guide in Refficks say when the new account was named, and when a sale is credited once that person pays.

Sources

Have an account? Open this guide in Refficks for your own script and the checks that show when it is working. New to Refficks? Create an account.

More in Your sign-in