# **🔍 Overview**

When you deploy the OTTO pixel via a Cloudflare Worker, the Worker runs on every route it is assigned to. Simply adding a route with **no Worker attached** is not enough to exclude a path — Cloudflare does not treat an empty route as a block rule. This article explains the correct method to prevent the OTTO pixel from loading on specific paths, such as **yopki.com/app/\***, while keeping it active on the rest of your site.

# **⚙️ How Cloudflare Worker Routes Work**

Cloudflare matches Worker routes using a pattern list. When a request comes in, Cloudflare checks your route patterns **in order** and runs the first matching Worker it finds. Key behaviours to understand:

- A route with no Worker assigned does **not** override a broader route that has a Worker assigned.
- More specific routes do not automatically take priority — order and correct configuration matter.
- The only reliable way to skip the Worker for a path is to add an exclusion check **inside the Worker script itself**, or to restructure your routes carefully.

# **🚀 Method 1 — Add a Path Exclusion Inside the Worker Script (Recommended)**

This is the most reliable approach. Edit your OTTO Worker script to check the incoming request path and skip pixel injection for any excluded paths.

1. Log in to your **Cloudflare dashboard** and go to **Workers & Pages**.
2. Select the Worker that serves the OTTO pixel.
3. Click **Edit Code** to open the Worker editor.
4. At the very beginning of your `fetch` handler, add a path check like the example below:

**Example logic (add before any pixel injection code):**

- Get the URL from the incoming request.
- If the pathname starts with **/app/** (or any other path you want to exclude), return a plain **fetch(request)** — passing the request through without modification.
- Otherwise, continue with normal pixel injection.

In plain terms, your Worker should do the following: **if the path matches an excluded pattern, pass the request through untouched; if it does not match, run the pixel injection as usual.**

1. Click **Save and Deploy** after making your changes.
2. Test by visiting your excluded path (e.g. **yopki.com/app/dashboard**) and confirm the OTTO pixel script no longer appears in the page source.

# **🗺️ Method 2 — Restructure Cloudflare Routes**

If you cannot edit the Worker script directly, you can restructure your Cloudflare routes. This method requires careful ordering.

1. In your Cloudflare dashboard, go to **Workers & Pages → your Worker → Triggers → Routes**.
2. Remove any existing broad route such as **yopki.com/\*** that covers your entire site.
3. Add specific routes that cover **only** the paths where you want the pixel active. For example:

   - **yopki.com/blog/\*** → assign your OTTO Worker
   - **yopki.com/** → assign your OTTO Worker
   - **yopki.com/shop/\*** → assign your OTTO Worker
4. Do **not** add a route for **yopki.com/app/\*** at all — if no route matches that path, no Worker runs.
5. Save your changes and test the excluded path to confirm the pixel is absent.

**Important:** Method 2 requires you to explicitly list every path where the pixel should appear. If you add new sections to your site later, remember to add matching routes. Method 1 is generally easier to maintain.

# **✅ Verifying the Exclusion Is Working**

After applying either method, follow these steps to confirm the pixel is excluded correctly:

- Open your browser and navigate to a URL on the excluded path, for example **yopki.com/app/login**.
- Right-click the page and select **View Page Source**.
- Search for **otto** or the pixel script tag. It should **not** appear on excluded paths.
- Next, visit a page where the pixel should still be active and confirm it **does** appear in the source.
- In Search Atlas, go to the left sidebar and click **OTTO SEO**, then open **SEO Automation** to access the OTTO dashboard and verify that tracked pages are still reporting data correctly.

# **⚠️ Common Mistakes to Avoid**

- **Adding an empty route is not an exclusion.** A Cloudflare route with no Worker attached does nothing to block another Worker that matches the same path via a different route pattern.
- **Wildcard routes are greedy.** A route like **yopki.com/\*** will match **yopki.com/app/anything**. You must handle exclusions explicitly.
- **Caching can delay changes.** After updating your Worker or routes, allow up to two minutes and try a hard refresh (**Ctrl + Shift + R** or **Cmd + Shift + R**) before concluding a change has not worked.

# **💬 Need More Help?**

If you need further assistance, open the chat widget in the bottom-right corner of the platform and type **human teammate** to be connected with a member of our team.