Skip to content

84. Facebook Pixel Integration - tracking & retargeting

Poziom: Średni | Czas: 8 min

Facebook Pixel śledzi visitors → retargetuje NON-converters → shows ads tylko osobom zainteresowanych. ROI: 3-10X vs cold traffic.

Czym jest Facebook Pixel?

Facebook Pixel = tracking code planted на твоєму site

TRACKS:
✓ Who visits
✓ What pages viewed
✓ Actions taken (form submit, purchase)
✓ Time spent

ENABLES:
→ Retargeting ads (show ads à people WHO visited)
→ Lookalike audiences (find similar люди)
→ Conversion tracking (które ads work)
→ Optimization (FB finds best convertersautomatycznie)

Dlaczego Pixel?

WITHOUT PIXEL:
100 visitors → 5 convert → 95 LOST FOREVER

WITH PIXEL + RETARGETING:
100 visitors → 5 convert immediate
→ 95 see retargeting ads
→ 10 more return & convert

RESULT: 15 total conversions (3X!)

PLUS: FB learns WHO converts → shows ads dla podobnych

Setting Up Facebook Pixel

Step 1: Create Pixel:

Facebook Events Manager:
business.facebook.com/events_manager

1. Click "+ สร้าง Pixel"
2. Name: "CoachFlow Landing Pages"
3. Enter website URL (optional): coach flow.pl
4. Create Pixel

COPY Pixel ID: 1234567890123456

Step 2: Install w GHL:

GHL: Sites → Settings → Tracking Code

Paste в "<head>" section:

<!-- Facebook Pixel Code -->
<script>
!function(f,b,e,v,n,t,s)
{if(f.fbq)return;n=f.fbq=function(){n.callMethod?
n.callMethod.apply(n,arguments):n.queue.push(arguments)};
if(!f._fbq)f._fbq=n;n.push=n;n.loaded=!0;n.version='2.0';
n.queue=[];t=b.createElement(e);t.async=!0;
t.src=v;s=b.getElementsByTagName(e)[0];
s.parentNode.insertBefore(t,s)}(window, document,'script',
'https://connect.facebook.net/en_US/fbevents.js');

fbq('init', '1234567890123456'); // Your Pixel ID
fbq('track', 'PageView');
</script>

<noscript>
<img height="1" width="1" style="display:none"
src="https://www.facebook.com/tr?id=1234567890123456&ev=PageView&noscript=1"/>
</noscript>
<!-- End Facebook Pixel Code -->

Step 3: Verify Installation:

1. Install Facebook Pixel Helper (Chrome extension)
2. Visit your landing page
3. Click extension icon
   
SHOULD SHOW:
✓ "Pixel Found: 1234567890123456"
✓ "PageView event fired"

IF NOT:
→ Check code pasted correctly
→ Clear cache, reload
→ Wait 20 min (FB delay)

Standard Events (Pre-Built):

Facebook має 17 standard events:

1. PageView (automatic after init)
2. Lead (form submission)
3. Purchase (completed sale)
4. AddToCart
5. InitiateCheckout
6. CompleteRegistration
7. ViewContent
8. Search
9. Contact
10. Schedule (appointment booked)

Each має specific use case

Tracking Form Submissions:

GHL Thank You Page → Add Custom Code:

<!-- Track Lead Event -->
<script>
fbq('track', 'Lead', {
  content_name: 'Free Coaching Guide',
  value: 0,
  currency: 'USD'
});
</script>

NOW: Facebook knowsWHO submitted форму
Enables: Lookalike audiences з converters!

Tracking Purchases:

Purchase Confirmation Page → Custom Code:

<script>
fbq('track', 'Purchase', {
  value: 997.00,
  currency: 'USD',
  content_name: 'Coaching Program',
  content_type: 'product'
});
</script>

Facebook MEASURES:
- Which ads → sales
- ROAS (Return On Ad Spend)
- Cost per purchase

Custom Conversions:

Facebook Events Manager → Custom Conversions → Create

NAME: "Downloaded Lead Magnet"

RULES:
URL Contains: /thank-you-guide

EVENT: Lead (Optional)

SAVE

NOW: Can optimize campaigns for THIS specific action

Retargeting Audiences:

1. Website Visitors (Broad):

Facebook Ads Manager → Audiences → Create Custom Audience

SOURCE: Website (Pixel)

EVENTS: All website visitors

TIME FRAME: Last 30 days

NAME: "Website Visitors - 30 Days"

USE: Show ads à everyone WHO visited

2. Specific Page Visitors:

Custom Audience → Website

EVENTS: аудиторію who visited specific pages

RULES:
URL Contains: /pricing

TIME: Last 14 days

NAME: "Pricing Page Visitors"

USE: High intent! Offer discount to convert

3. Form Abandoners:

Custom Audience → Website

INCLUDE: Visited /landing-page
EXCLUDE: Visited /thank-you

TIME: Last 7 days

NAME: "Form Started But Not зробити Submitted"

USE: Remind них complete signup

4. Converters (для Lookalike):

Custom Audience → Website

EVENTS: Lead event

TIME: Last 180 days

NAME: "Lead Magnet Downloaders"



Create LOOKALIKE Audience:
Based on: "Lead Magnet Downloaders"
Location: United States
Size: 1% (most similar 2.3M люди)

USE: Find NEW people similar до converters!

Event Setup API (Advanced):

For GHL Workflows → Trigger FB events:

Webhook Action in Workflow:

URL: https://graph.facebook.com/v18.0/{pixel_id}/events
Method: POST

BODY:
{
  "data": [{
    "event_name": "Lead",
    "event_time": {{timestamp}},
    "user_data": {
      "em": "{{contact.email}}",
      "ph": "{{contact.phone}}",
      "fn": "{{contact.first_name}}",
      "ln": "{{contact.last_name}}"
    },
    "custom_data": {
      "value": 0,
      "currency": "USD",
      "content_name": "Free Guide"
    }
  }],
  "access_token": "YOUR_ACCESS_TOKEN"
}

Server-side tracking (更reliable than browser)

Campaign Optimization with Pixel:

1. Conversion Campaigns:

Facebook Ads Manager → Create Campaign

OBJECTIVE: Conversions

CONVERSION EVENT: Lead (from Pixel)

FB AUTO-OPTIMIZES:
→ Shows ads до людей likely convert
→ Based Pixel data (WHO converted before)
→ Lower cost per lead

2. Measuring ROAS:

Pixel tracks purchases → FB calculates:

Ad Spend: $1,000
Revenue (tracked from Pixel): $5,000

ROAS = $5,000 / $1,000 = 5X

"For every $1 spent, earned $5"

FB can AUTO-BID for target ROAS (e.g., 3X minimum)

Testing Pixel Events:

Facebook Events Manager → Test Events

1. Enter your page URL
2. Click "Open Website"
3. Navigate & submit forms
4. SEE events fire в real-time:
   - PageView ✓
   - Lead ✓
   - Purchase ✓

DEBUG issues before running ads!

Common Pixel Issues:

❌ Pixel NOT firing
→ Check code placement (should be <head>)
→ Check Pixel ID correct
→ Use Facebook Pixel Helper extension

❌ Events fire multiple times
→ Remove duplicate code
→ Check Thank You page doesn't reload

❌ Conversions not tracked
→ Verify events على Thank You page (not form page)
→ Check Custom Code section в GHL

❌ Audience size TOO small
→ Wait (takes 24-48h toбудувати)
→ Increase time window (30 → 90 → 180 days)
→ Lower traffic → Widen criteria

GDPR/Privacy Compliance:

EU VISITORS NEED CONSENT:

Cookie Banner MUST ask permission:

"Ми використовуємо cookies і FB Pixel для ads"

[Accept] [Reject]

IF Reject:
→ DON'T load FB Pixel
→ lossoù tracking але compliant

TOOLS:
- CookieBot
- Cookieyes
- OneTrust

OR: GHL built-in consent management

iOS 14+ Changes (Important!):

Apple's ATT (App Tracking Transparency):

Users OPT OUT → FB Pixel limited

IMPACT:
- 7-day attribution window (was 28)
- 8 events max per domain
- Delayed reporting

SOLUTION:
Use Conversion API (server-side tracking)
Supplement browser Pixel

Pixel Data Retention:

Facebook STORES Pixel data:

Default: 180 days

Change:
Events Manager → Data Sources → [Pixel] → Settings
→ Event Data Retention: 90 / 180 days

Longer = Bigger audiences але privacy concerns

Retargeting Ad Best Practices:

✅ Carousel ads (show multiple offerings)
✅ Dynamic creative (FB auto-tests variations)
✅ Frequency cap (max 3 impressions/week - not annoying)
✅ Exclude converters (don't waste budget)
✅ Custom kopie (acknowledge they visited: "Back again?")
✅ Offer incentive (10% OFF for returning)
✅ Testimoni / social proof (build trust)

❌ Generic ads (same као cold traffic)
❌ Showing ad 10+ times (annoyance!)
❌ No clear CTA

ROI Example:

BEFORE PIXEL:

Cold Traffic Campaign:
$2,000 ad spend → 40 leads = $50/lead
5 customers @ $500 each = $2,500 revenue
ROI: $2,500 / $2,000 = 1.25X (barely profitable)

AFTER PIXEL + RETARGETING:

Cold Traffic:
$1,500 → 30 leads → 4 customers = $2,000 revenue

Retargeting (warm traffic):
$500 → 25 leads (cheaper!) → 6 customers = $3,000

TOTAL:
$2,000 spend → 55 leads → 10 customers → $5,000 revenue
ROI: $5,000 / $2,000 = 2.5X (profitable!)

Pixel drove EXTRA 6 customers = +$3,000 με SAME budget

Quick Setup Checklist:

☑ Facebook Pixel created (Events Manager)
☑ Pixel ID copied
☑ Code додано до GHL site (<head> section)
☑ PageView event verified (Pixel Helper extension)
☑ Lead event added (Thank You page)
☑ Purchase event dodano (if applicable)
☑ Pixel tested (Test Events tool)
☑ Custom Audience створено (Website Visitors - 30 days)
☑ Retargeting campaign launched
☑ Lookalike Audience created (1% similar до converters)
☑ GDPR consent banner (if EU traffic)
☑ Monitor daily: Ads Manager → Pixel events

Následující krok: 85. Google Analytics Setup