> For the complete documentation index, see [llms.txt](https://docs.moleculedata.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.moleculedata.com/tracking-ad-channels/website-tracking.md).

# Molecule Pixel

Molecule's own website tracker. Install the Shopify pixel or a short code snippet, and Molecule records visits, ad clicks and purchases itself.

The **Molecule Pixel** is Molecule's own tracker for your website. It records each visit's landing page, with its UTM parameters and ad click ids (such as Google's `gclid` or Meta's `fbclid`), and the purchase that ends the visit. That lets Molecule see which visit, and which ad click, led to an order, even when the order itself arrived without UTMs.

{% hint style="info" %}
**The Molecule Pixel is part of the Pro and Enterprise plans.** On other plans, its page says "Molecule Pixel is on Pro".
{% endhint %}

## Where to find it

Click **Molecule Pixel** in the menu, or open **Integrations** and click **Open** on the **Molecule Pixel** tile, under Attribution & Revenue.

Admins add and change sites. Every other member can see each site's status. You can add up to 5 sites; ask us if you need more.

## Add a site

1. Click **Add a site**.
2. Choose how you install it: **Shopify** or **Custom code**.
3. Give the site a name, then:
   * **Shopify**: if you have more than one store connected, choose the store. Your store's own domains are used, so there is nothing to type.
   * **Custom code**: list your **Allowed domains**, one per line, for example `https://www.yourshop.com`. Use `https://*.yourshop.com` to cover every subdomain. Events from any other domain are held back.
4. Click **Create site**, then open the site's card to install it.

## Install on Shopify

The Shopify option uses the Molecule web pixel, which comes with the Molecule Data app. It works only on a store connected through the Molecule Data app from the Shopify App Store. A store connected with a custom app token cannot run the pixel.

1. Open the site's card and click **Activate**.
2. The first time, Molecule needs your permission in Shopify to add the pixel to the store. The card says so and shows an **Approve in Shopify** button. Click it, approve the permission in your Shopify admin, then come back and click **Activate** again. The person who approves must be signed in to that store's Shopify admin as someone who can manage apps, and to Molecule as an admin of your company, in the same browser. The card keeps the reason and the button until the pixel is approved.
3. When the card says **The pixel is active on your store**, you are done. There is no code to paste.

If Shopify does not answer, the card says so and you can try again. Your site stays set up.

**What the pixel records:** each visit's landing page (with its campaign and ad-click parameters), the pages, products, cart and checkout steps viewed, and the order that ends the visit (order id and value), under an anonymous visitor id. It runs only when your store's privacy settings allow analytics for that visitor, and it collects no names, emails, phone numbers or addresses.

## Install with custom code

Use this for any site that is not on Shopify. The site's card shows the code with your site key already in it, each part with a copy button. You can add it in your site's code or with Google Tag Manager.

1. **Base code**: paste it inside `<head>` on every page. It sends a PageView. On a single-page site, each URL change sends one more PageView, so nothing else is needed.
2. **Purchase**: on the order-confirmation page, call it once per order with the order's value, currency and id.
3. **Content-Security-Policy**: if your site has one, add the line the card shows.
4. Load one page of your site, then click **Validate PageView** on the card.

The custom code has no consent logic of its own. Like the Meta Pixel, it sends whenever your site's code calls it, so your site decides when it runs.

[Install with custom code](https://docs.moleculedata.com/tracking-ad-channels/website-tracking/custom-code.md) has the full steps, including Google Tag Manager, how to test a Purchase, and troubleshooting.

## Status

Each site's card shows where it stands. Events show on the card within about a minute; reports include them from the next day.

| Status            | What it means                                                                                 |
| ----------------- | --------------------------------------------------------------------------------------------- |
| **Waiting**       | No event yet. Open your site and load one page, then click **Validate PageView**              |
| **Receiving**     | Events are arriving. The card shows when the last one was confirmed                           |
| **Check domains** | Events are arriving from a domain that is not in your allowed domains. Add it to receive them |
| **Paused**        | Nothing is collected until you resume                                                         |

## Managing a site

Admins can change a site from its card:

* **Save domains**: change a custom-code site's allowed domains.
* **Pause** and **Resume**: nothing is collected while a site is paused.
* **Rotate key**: creates a new site key. The old one keeps working for 7 days so you can swap it in your code; **Stop old key now** ends it early. On a Shopify site, Molecule sends the new key to the pixel for you.
* **Delete site**: its keys stop working. Data already collected is kept.

## How Molecule uses it

A new site starts by collecting. Molecule collects for 30 days and checks the tracker's visits and purchases against your orders, while your reports keep working as before. After that check, Molecule switches your attribution to the tracker. You don't need to do anything.

Once your attribution uses the tracker:

* **An order's journey is every visit by the same visitor in the 30 days before the purchase.** Your attribution method then shares the order between those visits as usual. A purchase is matched to an order only when its order id matches exactly one order and no other visitor claims it. Anything less certain is left unmatched, never guessed.
* **Click ids name the channel.** A visit whose landing page carries an ad platform's click id is credited to that platform, with or without UTMs.
* **UTMs still name the campaign and the ad.** If a link carries Triple Whale's `tw_` parameters and no UTMs, Molecule reads those instead.
* **Click ids are remembered.** The tracker keeps them in a first-party cookie for up to 90 days (on Shopify, only for visitors who allow marketing), so a purchase on a later visit can still be credited to the click. Some browsers keep cookies for less time.

| Click id                    | Channel    |
| --------------------------- | ---------- |
| `gclid`, `gbraid`, `wbraid` | Google Ads |
| `fbclid`                    | Meta       |
| `ttclid`                    | TikTok     |
| `ScCid`                     | Snapchat   |
| `epik`                      | Pinterest  |
| `cto_pld`                   | Criteo     |

{% hint style="info" %}
The Molecule Pixel does not replace UTMs. Keep the Molecule UTM templates in your ads: they tell Molecule which campaign and ad a visit came from. [The UTM Tracking page](https://app.moleculedata.com/docs/tracking-ad-channels/utm-tracking-page) in the app's Docs shows how to find the ads that are missing them.
{% endhint %}
