Loading source
Pulling the file list, source metadata, and syntax-aware rendering for this listing.
Source from repo
Creates and optimizes paid ad campaigns on Google Ads, Meta, LinkedIn, Twitter/X, and TikTok with platform-specific strategy.
Files
Skill
Size
Entrypoint
Format
Open file
Syntax-highlighted preview of this file as included in the skill package.
references/conversion-tracking.md
1# Conversion Tracking Setup23How to set up conversion tracking pixels across ad platforms. This guide covers installation, event configuration, and validation — everything a marketer needs to ensure ad spend is properly attributed.45---67## Why This Matters89Without conversion tracking:10- Ad platforms can't optimize for your actual goals11- You're flying blind on ROAS and CPA12- Retargeting audiences can't be built13- You'll waste budget on impressions that don't convert1415Get tracking right before spending a dollar on ads.1617---1819## Platform Pixels Overview2021| Platform | Pixel/Tag Name | Events API | Key Events |22|----------|---------------|:----------:|------------|23| **Google Ads** | Google tag (gtag.js) | Enhanced Conversions | purchase, sign_up, generate_lead |24| **Meta** | Meta Pixel + CAPI | Conversions API | Purchase, Lead, ViewContent, AddToCart |25| **LinkedIn** | Insight Tag | Conversions API | conversion (URL or event-based) |26| **TikTok** | TikTok Pixel | Events API | Purchase, ViewContent, AddToCart, CompleteRegistration |27| **Twitter/X** | Twitter Pixel | - | Purchase, SignUp, Download |2829---3031## Google Ads3233### Install the Google tag3435Add to every page, in `<head>`:3637```html38<script async src="https://www.googletagmanager.com/gtag/js?id=AW-XXXXXXXXX"></script>39<script>40window.dataLayer = window.dataLayer || [];41function gtag(){dataLayer.push(arguments);}42gtag('js', new Date());43gtag('config', 'AW-XXXXXXXXX');44</script>45```4647Replace `AW-XXXXXXXXX` with your Conversion ID from Google Ads > Tools > Conversions.4849### Set up conversion actions5051In Google Ads > Goals > Conversions > New conversion action:5253| Conversion | Category | Value | Count |54|-----------|----------|-------|-------|55| Purchase | Purchase | Dynamic (order value) | Every |56| Sign up / Lead | Sign-up | Fixed ($X estimated value) | One |57| Demo request | Lead | Fixed ($X estimated value) | One |58| Free trial start | Sign-up | Fixed ($X estimated value) | One |5960### Fire conversion events6162```javascript63// Purchase64gtag('event', 'conversion', {65'send_to': 'AW-XXXXXXXXX/CONVERSION_LABEL',66'value': 99.00,67'currency': 'USD',68'transaction_id': 'ORDER-123'69});7071// Lead / Sign up72gtag('event', 'conversion', {73'send_to': 'AW-XXXXXXXXX/CONVERSION_LABEL',74'value': 50.00,75'currency': 'USD'76});77```7879### Enhanced Conversions8081Sends hashed first-party data (email, phone) to improve attribution after cookie restrictions. Enable in Google Ads > Goals > Settings > Enhanced conversions.8283```javascript84gtag('set', 'user_data', {85'email': '[email protected]', // auto-hashed by gtag86'phone_number': '+11234567890'87});88```8990### Google Tag Manager alternative9192If using GTM instead of inline gtag.js:931. Install GTM container on all pages942. Create Google Ads conversion tags in GTM953. Set triggers for conversion events (form submissions, purchases)964. Use the Data Layer to pass dynamic values (order amount, transaction ID)975. Test with GTM Preview mode before publishing9899---100101## Meta (Facebook/Instagram)102103### Install the Meta Pixel104105Add to every page, in `<head>`:106107```html108<script>109!function(f,b,e,v,n,t,s)110{if(f.fbq)return;n=f.fbq=function(){n.callMethod?111n.callMethod.apply(n,arguments):n.queue.push(arguments)};112if(!f._fbq)f._fbq=n;n.push=n;n.loaded=!0;n.version='2.0';113n.queue=[];t=b.createElement(e);t.async=!0;114t.src=v;s=b.getElementsByTagName(e)[0];115s.parentNode.insertBefore(t,s)}(window, document,'script',116'https://connect.facebook.net/en_US/fbevents.js');117fbq('init', 'YOUR_PIXEL_ID');118fbq('track', 'PageView');119</script>120```121122Replace `YOUR_PIXEL_ID` from Meta Events Manager.123124### Standard events125126```javascript127// View a product or key page128fbq('track', 'ViewContent', {129content_name: 'Pro Plan',130content_category: 'Pricing',131value: 29.00,132currency: 'USD'133});134135// Lead capture (form submit, demo request)136fbq('track', 'Lead', {137content_name: 'Demo Request',138value: 50.00,139currency: 'USD'140});141142// Purchase143fbq('track', 'Purchase', {144value: 99.00,145currency: 'USD',146content_type: 'product',147contents: [{ id: 'pro-plan', quantity: 1 }]148});149150// Add to cart (e-commerce)151fbq('track', 'AddToCart', {152content_ids: ['SKU-123'],153content_type: 'product',154value: 49.00,155currency: 'USD'156});157```158159### Conversions API (CAPI)160161Server-side tracking that works alongside the pixel. Required for accurate tracking after iOS 14+ and cookie restrictions.162163Set up via:164- **Direct integration** — send events from your server to Meta's API165- **Partner integrations** — Shopify, WooCommerce, Segment, etc. have built-in CAPI support166- **Conversions API Gateway** — Meta's managed solution via AWS167168Key: send the same events from both pixel (browser) AND CAPI (server), with a shared `event_id` for deduplication.169170### Aggregated Event Measurement171172Required for iOS 14+ tracking. In Events Manager > Aggregated Event Measurement:1731. Verify your domain1742. Configure and prioritize your top 8 events in order of business importance1753. Purchase should typically be #1, Lead #2176177---178179180181### Install the Insight Tag182183Add to every page, before `</body>`:184185```html186<script type="text/javascript">187_linkedin_partner_id = "YOUR_PARTNER_ID";188window._linkedin_data_partner_ids = window._linkedin_data_partner_ids || [];189window._linkedin_data_partner_ids.push(_linkedin_partner_id);190(function(l) {191if (!l){window.lintrk = function(a,b){window.lintrk.q.push([a,b])};192window.lintrk.q=[]}193var s = document.getElementsByTagName("script")[0];194var b = document.createElement("script");195b.type = "text/javascript";b.async = true;196b.src = "https://snap.licdn.com/li.lms-analytics/insight.min.js";197s.parentNode.insertBefore(b, s);})(window.lintrk);198</script>199```200201### Conversion tracking202203LinkedIn supports two methods:204205**URL-based**: Fires when someone visits a specific URL (e.g., `/thank-you`).206Set up in Campaign Manager > Analyze > Conversion Tracking > Create Conversion.207208**Event-based**: Fire manually on specific actions:209210```javascript211window.lintrk('track', { conversion_id: YOUR_CONVERSION_ID });212```213214### LinkedIn CAPI215216For server-side tracking, LinkedIn offers a Conversions API. Set up via partner integrations (Segment, Tealium) or direct API calls. Deduplicates with the Insight Tag automatically when configured correctly.217218---219220## TikTok221222### Install the TikTok Pixel223224Add to every page, in `<head>`:225226```html227<script>228!function (w, d, t) {229w.TiktokAnalyticsObject=t;var ttq=w[t]=w[t]||[];230ttq.methods=["page","track","identify","instances","debug","on","off",231"once","ready","alias","group","enableCookie","disableCookie","holdConsent",232"revokeConsent","grantConsent"],ttq.setAndDefer=function(t,e)233{t[e]=function(){t.push([e].concat(Array.prototype.slice.call(arguments,0)))}};234for(var i=0;i<ttq.methods.length;i++)ttq.setAndDefer(ttq,ttq.methods[i]);235ttq.instance=function(t){for(var e=ttq._i[t]||[],n=0;236n<ttq.methods.length;n++)ttq.setAndDefer(e,ttq.methods[n]);return e};237ttq.load=function(e,n){var r="https://analytics.tiktok.com/i18n/pixel/events.js",238o=n&&n.partner;ttq._i=ttq._i||{},ttq._i[e]=[],ttq._i[e]._u=r,239ttq._t=ttq._t||{},ttq._t[e]=+new Date,ttq._o=ttq._o||{},240ttq._o[e]=n||{};var s=document.createElement("script");241s.type="text/javascript",s.async=!0,s.src=r+"?sdkid="+e+"&lib="+t;242var a=document.getElementsByTagName("script")[0];243a.parentNode.insertBefore(s,a)};244ttq.load('YOUR_PIXEL_ID');245ttq.page();246}(window, document, 'ttq');247</script>248```249250### Standard events251252```javascript253// View content254ttq.track('ViewContent', {255content_id: 'pro-plan',256content_type: 'product',257content_name: 'Pro Plan',258value: 29.00,259currency: 'USD'260});261262// Complete registration / sign up263ttq.track('CompleteRegistration', {264content_name: 'Free Trial'265});266267// Purchase268ttq.track('Purchase', {269content_id: 'pro-plan',270content_type: 'product',271value: 99.00,272currency: 'USD',273quantity: 1274});275276// Add to cart277ttq.track('AddToCart', {278content_id: 'SKU-123',279content_type: 'product',280value: 49.00,281currency: 'USD'282});283```284285### Events API (server-side)286287TikTok's Events API works like Meta's CAPI — send the same events from your server for better attribution. Use `event_id` for deduplication with browser pixel events.288289### Advanced Matching290291Pass hashed user data for better attribution:292293```javascript294ttq.identify({295email: '[email protected]', // auto-hashed296phone_number: '+11234567890'297});298```299300---301302## Validation Checklist303304After installing any pixel, verify before going live:305306### Browser-side checks307308- [ ] Pixel fires on every page (check via browser extension)309- [ ] Conversion events fire at the right moment (after confirmed action, not on button click)310- [ ] Event parameters contain correct values (currency, amount, content IDs)311- [ ] No duplicate events firing on the same action312- [ ] Events fire on both desktop and mobile313314### Platform-side checks315316- [ ] Events appear in the platform's event manager/diagnostics317- [ ] Test conversions show correct values318- [ ] Event match quality is acceptable (Meta: score > 6)319- [ ] Server-side events are deduplicating with browser events (not double-counting)320321### Debugging tools322323| Platform | Tool |324|----------|------|325| Google | Google Tag Assistant, Chrome DevTools Network tab |326| Meta | Meta Pixel Helper (Chrome extension), Events Manager Test Events |327| LinkedIn | Insight Tag Validator in Campaign Manager |328| TikTok | TikTok Pixel Helper (Chrome extension), Events Manager |329| All | GTM Preview Mode (if using Google Tag Manager) |330331---332333## Common Mistakes334335- **Firing purchase events on button click instead of confirmed payment** — always fire on the success/thank-you page or after server confirmation336- **Missing deduplication between pixel and server events** — without a shared `event_id`, you'll double-count conversions337- **Not testing on mobile** — many pixels break on mobile browsers or in-app webviews338- **Hardcoded test values** — remove test transaction amounts before going live339- **Forgetting to exclude internal traffic** — your team's visits inflate conversion data340- **Installing pixels without consent management** — GDPR/CCPA require user consent before firing tracking pixels in applicable regions341- **Pixel installed but no conversion actions created** — the pixel collects data, but the ad platform won't optimize without defined conversion actions342343---344345## When to Use Server-Side Tracking346347Browser-only tracking is increasingly unreliable due to:348- iOS 14+ App Tracking Transparency349- Third-party cookie deprecation350- Ad blockers (30%+ of tech audiences)351352**Use server-side (CAPI/Events API) when:**353- Running Meta or TikTok ads (strongly recommended)354- Your audience is tech-savvy (higher ad blocker usage)355- You need accurate purchase/revenue attribution356- You're spending >$5K/month on any platform357358**Server-side is optional when:**359- Running Google Ads only (Enhanced Conversions covers most gaps)360- Low ad spend / testing phase361- B2B with LinkedIn only (Insight Tag is still reliable)362