---
name: conversionlinker-install
description: Install ConversionLinker on the owner's product per their CL pixel config, verify events and configured destinations via setup status, ask the owner when unsure.
---

# ConversionLinker install (agent procedure)

Use this skill when the owner asked you to install ConversionLinker on **their** SaaS, store, or site. The owner already created the pixel, chose the platform, and connected ad destinations (Meta, Google Ads, GA4, TikTok, etc.) **inside the ConversionLinker app**. You do not create pixels, OAuth connections, or ad accounts.

## Prerequisites (from owner or one-line prompt)

- Pixel `display_id` (e.g. `CL-…`)
- Goal: `store` | `leads` | `subscriptions`
- Platform type configured in CL (e.g. `nextjs`, `shopify`, `woocommerce`)
- Plugin API key: `cl_live_…`
- App host: `https://app.conversionlinker.com` (or local dev host from prompt)

Optional MCP: `https://{appHost}/api/mcp` with the same bearer key.

## Step 1 — Load install contract

Fetch bootstrap + event recipes (do not invent snippets):

```
GET https://{appHost}/api/plugin/v1/pixels/{displayId}/agent-install?goal={goal}
Authorization: Bearer cl_live_…
```

Or MCP: `get_install_contract` with `displayId` and `goal`.

Read `contract.bootstrapSnippet`, `contract.recipes`, `contract.primaryEvent`, and `contract.gdprEnabled`.

## Step 2 — Platform install (owner already chose platform)

Install **only** for the platform configured on the pixel. If this repository or theme clearly does not match (e.g. pixel is `shopify` but repo is a bare Rails API with no theme), **stop and ask the owner** which codebase or theme to use.

| Platform | Where to install |
|----------|------------------|
| **nextjs** / SaaS | Root app shell once (`app/layout.tsx`, `pages/_document`, etc.) before `</head>` |
| **shopify** | `layout/theme.liquid` before `</head>` (no Shopify app in this release) |
| **woocommerce** / **wordpress** | Prefer official ConversionLinker WordPress plugin + API token; else theme header |
| **magento** | Default layout / head template before `</head>` |
| **bigcommerce** | Script Manager or Stencil `base.html` head |
| **clickfunnels** | Funnel or site head tracking code |

Paste **bootstrap once** globally. `PageLoad` is automatic after bootstrap.

## Step 3 — Wire conversion events

- For each featured recipe, wire `clinker("event", name, payload)` only **after** the action succeeds (API 2xx, thank-you navigation, order confirmed)—not on button click alone.
- Use real `order_id`, `value`, `currency`, `contents[]` when available.
- No matching flow in code? **Skip** and list the event + reason.
- Cannot find where success happens? **Ask the owner** (one specific question).

Do not remove `cmpKey` from bootstrap when the contract says consent is enabled.

## Step 4 — End-to-end verification

1. Run or deploy. Exercise each wired flow on a page that loads the bootstrap.
2. Poll setup status until stable:

```
GET https://{appHost}/api/plugin/v1/pixels/{displayId}/setup-status?goal={goal}
Authorization: Bearer cl_live_…
```

Or MCP: `get_setup_status`.

3. Check `status` fields:
   - `pageLoadReceived` and `primaryEventReceived` → `installComplete`
   - `destinationNames` / `destinationCount` / `destinationsConnected` — what the **owner already connected** in CL (Meta, GA4, etc.)
   - `e2eComplete` — install on site **and** at least one destination enabled in CL

4. You **do not** log into Meta, Google, or TikTok. Forwarding to those platforms is configured in ConversionLinker. Your job is site install + confirming events hit CL + reporting configured destinations.

5. If the owner expected a destination that is **not** in `destinationNames`, tell them to connect it in **ConversionLinker → Integrations**. Do not fake OAuth.

## Step 5 — Report to owner (required format)

```
ConversionLinker install report
- Pixel: {displayId}
- Platform: {configured platform}
- Bootstrap: [installed location]
- Events wired: [list]
- Events skipped: [list + reason]
- Setup status: PageLoad={yes/no}, primary={event}={yes/no}, installComplete={yes/no}
- Destinations in CL: {destinationNames or "none — owner should connect in app"}
- e2eComplete: {yes/no}
- Questions for owner: [list or "none"]
```

## When to ask the owner

- Repo/theme does not match configured platform
- Multiple possible conversion success paths and you cannot tell which is canonical
- Custom checkout with no visible thank-you or webhook you can hook
- `destinationNames` empty but owner expects ads forwarding
- Missing or invalid API key

## Done criteria

- Bootstrap in the correct shell for the platform
- `installComplete: true` after a real test
- Clear report including destinations from setup status
- No silent guesses on success paths
