/** * Static tracking guide exposed as an MCP resource. * Claude reads this on connect and knows how to implement SealMetrics tracking * without calling any tool. * * This is an operational playbook, not just an API reference. * It tells the agent WHAT to do, HOW to decide, and WHERE to put things. */ export declare const TRACKING_GUIDE_URI = "sealmetrics://tracking-guide"; export declare const TRACKING_GUIDE_NAME = "SealMetrics Tracking Guide"; export declare const TRACKING_GUIDE_DESCRIPTION = "Operational playbook for implementing SealMetrics tracking on any website: pixel installation, conversions, microconversions, content grouping, and framework-specific patterns."; export declare const TRACKING_GUIDE_CONTENT = "# SealMetrics Tracking \u2014 Implementation Playbook\n\nYou are implementing SealMetrics analytics on a website. This guide tells you exactly what to do, step by step.\n\n---\n\n## Step 1: Get the pixel\n\nCall the `get_tracking_code` tool with the user's `site_id`. It returns:\n- `script_tag`: the exact `\n\n```\n\n### Next.js (App Router)\n```tsx\n// app/layout.tsx\nimport Script from 'next/script';\n\nexport default function RootLayout({ children }: { children: React.ReactNode }) {\n return (\n \n
\n {children}\n \n \n \n );\n}\n```\n\n### Vue / Nuxt\n```ts\n// nuxt.config.ts\nexport default defineNuxtConfig({\n app: {\n head: {\n script: [{ src: 'https://t.sealmetrics.com/t.js?id=SITE_ID', defer: true }]\n }\n }\n});\n```\n\n**Once the script is in place, pageviews are tracked automatically** \u2014 on load, on SPA navigation (pushState, replaceState, popstate), on back/forward. You do NOT need to add manual pageview calls.\n\n---\n\n## Step 3: Identify what to track\n\nAnalyze the website code and identify trackeable user actions. Classify each one as a **conversion** or a **microconversion**.\n\n### What is a conversion?\n\nA conversion is a **business goal** \u2014 the main thing the site owner wants users to do. It typically has monetary value or represents a completed transaction.\n\n| What you see in the code | Conversion type | Has value? |\n|--------------------------|-----------------|------------|\n| Purchase/checkout completion, order confirmation page | `purchase` | Yes \u2014 the order total |\n| Subscription payment, plan upgrade | `purchase` | Yes \u2014 the subscription price |\n| Contact form, demo request, quote request | `lead` | No (use `0`) |\n| Account registration, signup form | `signup` | No (use `0`) |\n| Booking confirmation, appointment scheduled | `booking` | Yes if there's a price, otherwise `0` |\n\n**Rule of thumb**: If the business would pay money to make this action happen, it's a conversion.\n\n### What is a microconversion?\n\nA microconversion is a **step toward a conversion** or an **engagement signal**. It tells you how users interact with the site before converting.\n\n| What you see in the code | Microconversion type |\n|--------------------------|---------------------|\n| \"Add to cart\" button | `add_to_cart` |\n| \"Add to wishlist\" / \"Save for later\" | `add_to_wishlist` |\n| Checkout step buttons (shipping, payment...) | `begin_checkout`, `checkout_shipping`, `checkout_payment` |\n| Newsletter/email signup form | `newsletter_signup` |\n| PDF/resource download link | `download` |\n| Video play button | `video_play` |\n| Video ends | `video_complete` |\n| Pricing page visited or pricing toggle clicked | `pricing_view` |\n| Share/social buttons | `share` |\n| Search form used | `search` |\n| Filter/sort applied | `filter_applied` |\n| Tab/accordion clicked to reveal content | `content_expand` |\n| Chat widget opened | `chat_open` |\n| Scroll milestones (25%, 50%, 75%, 100%) | `scroll_25`, `scroll_50`, `scroll_75`, `scroll_100` |\n\n**Rule of thumb**: If it shows intent or engagement but isn't the final goal, it's a microconversion.\n\n---\n\n## Step 4: Implement conversions\n\n### Syntax\n```js\nsealmetrics.conv(type, amount, properties?)\n```\n\n| Parameter | Type | Required | Description |\n|-----------|------|----------|-------------|\n| `type` | string | Yes | snake_case name for this conversion |\n| `amount` | number | Yes | Monetary value. Use `0` if no value (leads, signups) |\n| `properties` | object | No | Extra metadata (see \"Using properties\" below) |\n\n### Where to put it\n\nThe conversion call goes **at the moment the action succeeds**, not when the user clicks. For example:\n\n- **Form submission**: In the `onSubmit` handler, AFTER validation passes (or on the thank-you page)\n- **Purchase**: On the order confirmation/thank-you page, or in the success callback of the payment API\n- **Signup**: After the registration API call succeeds\n\n### Examples by pattern\n\n**Form submit (vanilla JS):**\n```js\ndocument.querySelector('#contact-form').addEventListener('submit', function(e) {\n // The form is about to submit \u2014 track the lead\n sealmetrics.conv('lead', 0, { form_name: 'contact', page: location.pathname });\n});\n```\n\n**Form submit (React):**\n```tsx\nconst handleSubmit = async (data: FormData) => {\n await api.submitContactForm(data);\n window.sealmetrics?.conv('lead', 0, { form_name: 'contact' });\n};\n```\n\n**Purchase (thank-you page):**\n```html\n\n\n```\n\n**Purchase (React, after payment API):**\n```tsx\nconst handlePayment = async () => {\n const result = await processPayment(cart);\n if (result.success) {\n window.sealmetrics?.conv('purchase', cart.total, {\n currency: cart.currency,\n payment_method: result.method\n });\n router.push('/thank-you');\n }\n};\n```\n\n**Signup (after API success):**\n```tsx\nconst handleRegister = async (formData: RegisterForm) => {\n const user = await api.register(formData);\n window.sealmetrics?.conv('signup', 0, { plan: formData.plan });\n router.push('/welcome');\n};\n```\n\n---\n\n## Step 5: Implement microconversions\n\n### Syntax\n```js\nsealmetrics.micro(type, properties?)\n```\n\n| Parameter | Type | Required | Description |\n|-----------|------|----------|-------------|\n| `type` | string | Yes | snake_case name for this event |\n| `properties` | object | No | Extra metadata (see \"Using properties\" below) |\n\n### Where to put it\n\nMicroconversions go **on the user action** \u2014 usually in click handlers, submit handlers, or event listeners.\n\n### Examples by pattern\n\n**Add to cart (vanilla):**\n```js\ndocument.querySelectorAll('.add-to-cart').forEach(function(btn) {\n btn.addEventListener('click', function() {\n sealmetrics.micro('add_to_cart', {\n product_id: this.dataset.productId,\n product_name: this.dataset.productName,\n price: parseFloat(this.dataset.price)\n });\n });\n});\n```\n\n**Add to cart (React):**\n```tsx\nfunction AddToCartButton({ product }: { product: Product }) {\n const handleClick = () => {\n addToCart(product);\n window.sealmetrics?.micro('add_to_cart', {\n product_id: product.id,\n product_name: product.name,\n price: product.price\n });\n };\n return ;\n}\n```\n\n**Newsletter signup:**\n```js\ndocument.querySelector('#newsletter-form').addEventListener('submit', function() {\n sealmetrics.micro('newsletter_signup', {\n position: this.closest('footer') ? 'footer' : 'inline'\n });\n});\n```\n\n**Video engagement:**\n```js\nvar video = document.querySelector('video');\nvideo.addEventListener('play', function() {\n sealmetrics.micro('video_play', { video_id: this.dataset.videoId });\n});\nvideo.addEventListener('ended', function() {\n sealmetrics.micro('video_complete', { video_id: this.dataset.videoId });\n});\n```\n\n**Scroll depth tracking:**\n```js\nvar scrollTracked = {};\nwindow.addEventListener('scroll', function() {\n var pct = Math.round(window.scrollY / (document.body.scrollHeight - window.innerHeight) * 100);\n [25, 50, 75, 100].forEach(function(milestone) {\n if (pct >= milestone && !scrollTracked[milestone]) {\n scrollTracked[milestone] = true;\n sealmetrics.micro('scroll_' + milestone);\n }\n });\n});\n```\n\n**Checkout funnel steps (React):**\n```tsx\n// When user moves from step to step\nconst goToStep = (step: number) => {\n setCurrentStep(step);\n const stepNames: Record