> ## Documentation Index
> Fetch the complete documentation index at: https://docs.cometly.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Track sign-ups with Auth0

> Track Auth0 sign-ups in Cometly: pass the comet_token through your Auth0 flow and send a webhook so each sign-up is tied to the ad behind it.

If you use [Auth0](https://auth0.com) for authentication and sign-ups, you can track Auth0 sign-ups in Cometly as events (an event is an action Cometly records, such as a lead or a purchase). You carry the visitor's `comet_token` through the Auth0 flow, then send the sign-up to Cometly with a webhook. The `comet_token` is the unique identifier that links a visitor's actions to their attribution journey in Cometly.

This matters because a sign-up that happens inside Auth0 is not tied to the visitor's journey on its own. With the token attached, each sign-up is linked to the ad or channel that brought the visitor in, so you can see which campaigns produce new users.

To attribute Auth0 sign-ups in Cometly, you need to:

1. Install the Cometly pixel on your website.
2. Capture the `comet_token` with the `cometToken()` function.
3. Pass the `comet_token` into your Auth0 sign-up flow.
4. Send a webhook to Cometly with the user's data.

For background on the token, see [Comet Token](https://docs.cometly.com/concepts/comet-token.md). If your users sign up with a social login such as Google, see [Track sign-ups made with OAuth](https://docs.cometly.com/guides/tracking/oauth-signups.md).

## 1. Install the Cometly pixel

The Cometly pixel (the tracking script you add to your website) must be installed on every relevant page, including the page where your Auth0 sign-up button or flow starts.

> [!NOTE]
>
> **SaaS companies:** install the Cometly pixel on all of your marketing site pages, and inside your app only on the registration and login pages. Do not install it across your entire SaaS application. See [Pixel setup for SaaS companies](https://docs.cometly.com/guides/tracking/pixel-setup-for-saas.md).

To install the pixel, follow [Install the Cometly pixel](https://docs.cometly.com/getting-started/install-pixel.md).

## 2. Capture the comet\_token

Once the pixel is installed, call the `cometToken()` function, which the Cometly pixel script provides, to get the unique tracking token of the current visitor.

```javascript theme={null}
const comet_token = cometToken();
```

Run this on the page where the sign-up is triggered, and pass the value through to your Auth0 sign-up metadata.

## 3. Pass comet\_token into the Auth0 sign-up

Depending on how you have set up Auth0, you can include the `comet_token` in:

* **User metadata** during a custom sign-up process
* **A hidden field**, if you use a custom sign-up form
* **Redirect callback URLs** or **state parameters** that keep the token through the flow

Here is an example that attaches it to the user metadata in a custom sign-up:

```javascript theme={null}
auth0.signup({
  email: userEmail,
  password: userPassword,
  user_metadata: { comet_token: cometToken() }
});
```

> [!WARNING]
>
> Make sure this data is available in your backend or in your Auth0 webhook after the sign-up is completed.

## 4. Send a webhook to Cometly

Once the user has signed up and you have their email and `comet_token` (and optionally their first and last name), send that data to a [Cometly webhook](https://docs.cometly.com/integrations/webhooks.md).

To get a webhook URL, go to **Events Manager** in Cometly, click **Create Event**, choose **Webhooks** under **App / Integration**, pick or create your sign-up event and click **Create**. Cometly then shows **Your webhook URL** with a **Copy** button.

![The Receive Data step for a new Sign Up webhook event, showing Your webhook URL and the Check for Data button, with an arrow pointing at the Copy button.](https://mintcdn.com/cometly/4NU5YV9iL1PADmGE/images/integrations/guides/auth0-sign-ups/01.webp?fit=max\&auto=format\&n=4NU5YV9iL1PADmGE\&q=85\&s=52c9d5058473cb2e699b4a9aee3bdde3)

Here is an example JSON payload:

```json theme={null}
{
  "event_name": "Sign Up",
  "comet_token": "123456abcdef",
  "email": "newuser@example.com",
  "first_name": "John",
  "last_name": "Doe"
}
```

Post this to your webhook URL. When you configure the mapping for the event in Cometly, map **Email** and **Comet Token** (click **Add Field** to add it) to the matching fields of your payload.

For the full walkthrough, see [Webhooks](https://docs.cometly.com/integrations/webhooks.md).

## Check it worked

Once this is in place, sign-ups made through Auth0 are attributed and tracked in Cometly. To confirm, activate the webhook event, then complete a test sign-up through Auth0. In [**Events Manager**](https://app.cometly.com/space/events-manager), open the **Events Log** tab and keep **Source** set to **Server**: the sign-up appears there within 60 seconds, with **SUCCESS** in the **Details** column.

## Frequently asked questions

### What happens if an Auth0 sign-up is sent to Cometly without the comet\_token?

Cometly still accepts an event that has an email address, because an email is enough to identify the person. The `comet_token` is what links the event to the visitor's browser session, so leaving it out makes attribution less accurate.

### How long does it take for an Auth0 sign-up to show up in Cometly?

The event shows in the Events Log within 60 seconds of being sent. It can take up to 15 minutes to appear in the reporting areas, such as the Report Builder or Ads Manager.

### Can I send Auth0 sign-ups with the Cometly API instead of a webhook?

Yes. A webhook works when your system can post the data to a URL on its own. If a developer would rather send the sign-up from your own backend with an API token, use the [Cometly API](https://docs.cometly.com/integrations/api.md) and include the same `email` and `comet_token`.

## Next steps

* [Set up, map and activate a Cometly webhook](https://docs.cometly.com/integrations/webhooks.md)
* [Track sign-ups made with OAuth (Sign up with Google)](https://docs.cometly.com/guides/tracking/oauth-signups.md)
* [Set up the Cometly pixel for a SaaS product](https://docs.cometly.com/guides/tracking/pixel-setup-for-saas.md)
* [Learn more ways to use the comet\_token](https://docs.cometly.com/concepts/comet-token.md)
* [Use the Events Log to check incoming events](https://docs.cometly.com/support/troubleshooting/general/event-log.md)

Still have questions or need a hand? We're happy to help. Reach our team at [support@cometly.com](mailto:support@cometly.com).


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.