> ## 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.

# Pixel setup for SaaS companies

> Follow this Cometly pixel setup for SaaS to track visitors from your marketing site into your app, so each sign-up is tied to the ad that produced it.

The Cometly pixel is a small script you add to your website. It tracks where your visitors come from and captures the details they enter in your forms (name, email and phone number). This guide covers the Cometly pixel setup for SaaS companies, where a visitor usually starts on a marketing site and signs up in a separate app.

Getting this right lets you see which ad or channel produced each sign-up, instead of losing the visitor when they move from one domain to the other. It also keeps your contacts clean, so separate users of your app are not merged into one person.

If you run a SaaS business with a marketing site and a separate app (for example `yourdomain.com` and `app.yourdomain.com`), three setup steps matter most:

1. [Install the Cometly pixel](#1-install-the-cometly-pixel)
2. [Enable cross domain tracking](#2-enable-cross-domain-tracking)
3. [Configure OAuth if applicable](#3-configure-oauth-if-applicable)

## 1. Install the Cometly pixel

Add the Cometly pixel to the `<head>` of:

* Your marketing website (including funnels, blogs, academy and so on)
* The registration and login pages of your application

You find the pixel script in Cometly under **Setup**, step 2 **Install the Cometly pixel**, in the **Install the pixel** section.

> [!WARNING]
>
> Add the pixel to **only** the registration and login pages of your app, not the entire app.
>
> Cometly automatically merges contacts when it detects they're the same person, even if they use different emails. This keeps data accurate, but merges can happen by mistake inside an app. For example, when a user invites other team members, all of their emails can be combined into one contact.

### Marketing site pixel installation

* For the general steps, see [Install the pixel](https://docs.cometly.com/getting-started/install-pixel.md).
* For platform-specific guides, see the [integrations overview](https://docs.cometly.com/integrations/overview.md).
* **Using Google Tag Manager?** Follow the [Google Tag Manager installation guide](https://docs.cometly.com/integrations/pixel/google-tag-manager.md).
* **Have a WordPress site?** Follow the [WordPress installation guide](https://docs.cometly.com/integrations/pixel/wordpress.md). WordPress needs extra steps to deal with caching.

If you must obtain user consent before running analytics or marketing cookies (for example under GDPR, ePrivacy or CPRA), you can integrate Cometly with your consent banner so that no data is tracked until the user opts in. See [Cometly and your consent banner](https://docs.cometly.com/guides/tracking/consent.md).

### Add and verify domains

1. In Cometly, go to **Setup** and open step 2, **Install the Cometly pixel**.
2. Under **Add domains**, add every domain and subdomain where the pixel is installed, then click **Add Domain**.
3. Under **Verify your pixel**, click **Verify** next to each domain.

When you add a domain, Cometly also adds it to that space's referrer exclusion list. Referral clicks that come from your own domains (for example from `cometly.com` to `app.cometly.com`) are then left out of your referral reports, which keeps your referral data accurate.

To exclude more domains, go to **Settings**, then **Traffic permissions** under **Workspace**, and use the **Exclude domain from referrer source** card. See [Exclude referral domains](https://docs.cometly.com/guides/tracking/exclude-referral-domains.md).

## 2. Enable cross domain tracking

To track users as they move between your marketing site and your app, Cometly uses a unique identifier called the `comet_token`. This token links user interactions across different domains, so traffic and conversions are attributed correctly.

**Example:** traffic moving from `cometly.com` to `app.cometly.com`.

**How to enable it:** if the pixel is installed on both your marketing website and your app registration page, go to **Setup**, step 2 **Install the Cometly pixel**, and turn on **Automatic Cross Domain Tracking** under **Pixel options**. Your verified domains then use cross domain tracking automatically.

![Pixel options card in Setup step 2 with an arrow pointing at the Automatic Cross Domain Tracking switch, which is turned on, above the First Party Domain Tracking and Script version settings.](https://mintcdn.com/cometly/BM7eSn6-ecx8ZzBx/images/guides/tracking/pixel-setup-for-saas/01.webp?fit=max\&auto=format\&n=BM7eSn6-ecx8ZzBx\&q=85\&s=2317139cbe8dccc1d4a46e0a0a77c0e4)

> [!NOTE]
>
> Changing your domains or pixel options can change your tracking script. When Cometly tells you the script has changed, copy the updated script from the **Install the pixel** section and replace the one on your site.

**What this does:**

* **Automatic tracking:** the `comet_token` is passed between your verified domains automatically.
* **Connected user journeys:** you track user interactions across multiple websites as one journey.

**Why it matters:** with this feature on, user activity is tracked no matter which of your domains the user is on. Without it, each domain treats the visitor as a brand new visitor.

**Troubleshooting:** if automatic cross domain tracking does not work for your setup, you can set it up manually by following the [cross domain tracking guide](https://docs.cometly.com/guides/tracking/cross-domain-tracking.md).

## 3. Configure OAuth if applicable

The Cometly pixel automatically captures essential form fields such as full name, first name, last name, email and phone number. Cometly uses the captured email address to link user actions to their attribution journey.

If your app uses OAuth for authentication (Google or another social login), you need a small extra setup so Cometly can connect the sign-up back to the ad that brought the user in:

* **Follow the setup guide:** see the [OAuth configuration guide](https://docs.cometly.com/guides/tracking/oauth-signups.md) for step-by-step instructions.
* **Send the `comet_token`:** make sure the `comet_token` is included during the OAuth process. This token links the OAuth authentication event back to the original user journey, so Cometly can track sign-ups and authentication events accurately.

**Why this matters:** by sending the `comet_token`, each OAuth event is attributed to the user's first interaction with your platform.

## Check it worked

In **Setup**, step 2 **Install the Cometly pixel**, each domain under **Verify your pixel** shows **Pixel detected**, and **Automatic Cross Domain Tracking** is turned on under **Pixel options**. If your app domain shows **Pixel not detected**, see the first question below.

## Frequently asked questions

### Why does Cometly pixel verification fail on my app domain?

If you are already logged in, your app domain redirects you to another page (for example `/dashboard`), and Cometly cannot match the redirect when the path is empty. In the verification dialog, expand **Test a specific page**, enter the path you land on after login (only the path, not the full URL), then click **Verify**. See [Install and verify the Cometly pixel](https://docs.cometly.com/getting-started/install-pixel.md).

### Why are several users merged into one contact in Cometly?

This usually happens when the pixel is installed on every page of your app. When a user types another person's email, for example to invite a colleague, Cometly may merge the two into one contact. Limit the pixel to your app's registration and login pages. See [Troubleshoot multiple emails on a contact](https://docs.cometly.com/support/troubleshooting/pixel/multiple-emails-on-a-contact.md).

### Do I need cross domain tracking if my app is on a subdomain?

Yes. If traffic flows from a site such as `cometly.com` to an app such as `app.cometly.com`, cross domain tracking makes sure the visitor is tracked as the same person on both. You need at least one domain under **Add domains** before you can turn on **Automatic Cross Domain Tracking**.

## Next steps

* [Install and verify the Cometly pixel](https://docs.cometly.com/getting-started/install-pixel.md)
* [Set up cross-domain tracking](https://docs.cometly.com/guides/tracking/cross-domain-tracking.md)
* [Track sign-ups made with OAuth](https://docs.cometly.com/guides/tracking/oauth-signups.md)
* [Check your installation with the Cometly Pixel Helper](https://docs.cometly.com/guides/tracking/pixel-helper.md)
* [Test form tracking on your pages](https://docs.cometly.com/guides/form-tracking/testing.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.