Meta Pixel & Conversions API

When a user completes a subscription, Pelcro fires a browser event. A bridge script pushes that event into GTM's dataLayer, and GTM fires your Meta Pixel Purchase tag. All tag configuration happens inside GTM.

Prerequisites — complete these before starting:

  1. GTM must be installed on your site and the bridge script, Data Layer Variables, and Pelcro - Purchase trigger must be set up. See Google Tag Manager for all of this.
  2. Meta Pixel base code must be installed (Step 1 below).

How it works

User completes a subscription
  → Bridge script pushes purchase data into window.dataLayer
  → GTM detects the purchase event via the Pelcro - Purchase trigger
  → GTM fires your Meta Pixel Purchase tag
  → Meta records the conversion

Step 1 — Install the Meta Pixel base code via GTM

Create a Custom HTML tag in GTM that loads the Meta Pixel script on all pages. This tag only needs to be created once.

Tag configuration:

  • Tag type: Custom HTML
  • Trigger: All Pages

Paste the following into the HTML field, replacing YOUR_PIXEL_ID with your actual pixel ID from Meta Events Manager:

<!-- Meta 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', 'YOUR_PIXEL_ID');
  fbq('track', 'PageView');
</script>
<noscript>
  <img height="1" width="1" style="display:none"
    src="https://www.facebook.com/tr?id=YOUR_PIXEL_ID&ev=PageView&noscript=1"/>
</noscript>
<!-- End Meta Pixel Code -->

Publish and verify the pixel fires on page load using the Meta Pixel Helper browser extension before continuing.


Step 2 — Create the Meta Pixel Purchase tag

When does this fire? On every completed subscription, including free trials (value will be 0). It does not fire on renewals. To capture renewal conversions use the Conversions API in Step 3.

By this point the Pelcro - Purchase Custom Event trigger and the dlv - value, dlv - currency, dlv - transaction_id variables are already set up in GTM from the Google Tag Manager guide. You only need to create the tag.

  1. Go to Tags > New
  2. Set the tag type to Custom HTML
  3. Name the tag Meta Pixel - Purchase
  4. Paste the following:
<script>
  fbq('track', 'Purchase', {
    value: {{dlv - value}},
    currency: {{dlv - currency}},
    content_type: 'subscription',
    order_id: {{dlv - transaction_id}}
  });
</script>
  1. Set the trigger to Pelcro - Purchase
  2. Save and publish

Step 3 — Meta Conversions API (server-side, optional)

This step requires a developer or a no-code tool such as Zapier or Make.

The Meta Conversions API (CAPI) lets you send conversion events directly from your server, bypassing browser ad blockers. When running both browser Pixel and CAPI you must use a shared event ID so Meta deduplicates them.

A. Create a pre-processing tag in GTM

Create a Custom HTML tag that fires before the Meta Pixel Purchase tag (use tag sequencing):

<script>
  window.dataLayer = window.dataLayer || [];
  window.dataLayer.push({
    meta_event_id: 'pelcro-sub-' + {{dlv - transaction_id}}
  });
</script>

B. Create a variable for the event ID

Variable name (GTM)Variable typeData layer key name
dlv - meta_event_idData Layer Variablemeta_event_id

C. Update the Meta Pixel Purchase tag

<script>
  fbq('track', 'Purchase', {
    value: {{dlv - value}},
    currency: {{dlv - currency}},
    content_type: 'subscription',
    order_id: {{dlv - transaction_id}}
  }, {
    eventID: {{dlv - meta_event_id}}
  });
</script>

D. Send the same event ID from your server

Use Pelcro webhooks to forward subscription events to Meta CAPI. Use pelcro-sub-{subscription_id} as the event_id — this must match exactly what the browser Pixel sends.

For webhook payload details see Pelcro Webhooks.


Step 4 — Map the full funnel (optional)

Pelcro fires events at every step of the subscription funnel. Map each one to the corresponding Meta standard event to build a complete conversion funnel in Meta Ads Manager.

Pelcro event nameRecommended Meta eventWhen it fires
Product Modal ViewedViewContentUser opens the product selection modal
Plan Modal ViewedViewContentUser opens the plan selection modal
modal subscription create viewedInitiateCheckoutUser reaches the payment step
purchasePurchaseSubscription is successfully created
modal subscription success viewedPurchase (confirmation)Success screen is shown after payment
RegisteredCompleteRegistrationUser creates a new account
Logged inUser signs in (useful for audience segmentation)

For each event, create a Custom Event trigger in GTM using the event name exactly as shown (case-sensitive), then create a Custom HTML tag. Example for InitiateCheckout:

<script>
  fbq('track', 'InitiateCheckout', {
    content_type: 'subscription'
  });
</script>

Verification checklist

GTM Preview mode

  • Complete a test subscription and confirm the purchase Custom Event appears in the GTM Preview timeline
  • Confirm dlv - value shows a number (not undefined) after the event
  • Confirm dlv - currency shows a lowercase currency code
  • Confirm the Meta Pixel - Purchase tag fires after the purchase event

Browser (Pixel Helper)

  • Meta Pixel Helper shows PageView on all pages
  • Meta Pixel Helper shows Purchase event after a successful test subscription
  • value and currency fields are populated in the Pixel Helper event details
  • No duplicate Purchase events appear for a single transaction

Meta Events Manager

  • Test Events tab shows Purchase events flowing in real time
  • Event count matches the number of test subscriptions completed
  • If CAPI configured: both browser and server events appear, Meta deduplicates to a single conversion

Known limitations

LimitationDetail
Free trial conversionsFree trial subscriptions send a value of 0. Filter these in Meta Ads Manager using event value rules if needed.
Subscription renewalsBrowser Pixel only captures new subscriptions, not renewals. Use CAPI (Step 3) for renewals.
Zero-decimal currenciesHandled correctly by the bridge script — raw amount sent without dividing by 100.
Gift subscriptionsBehave the same as regular subscriptions from the GTM perspective.

Troubleshooting

The purchase event is not appearing in GTM Preview mode.
Confirm the bridge script is present on your site (see Google Tag Manager). Complete a test subscription and check the GTM Preview timeline. If the event does not appear, check the browser console for JavaScript errors.

The value field is blank or showing undefined in Meta.
Open GTM Preview and confirm dlv - value shows a number after the purchase event. If it shows undefined, verify the variable is set to Data Layer Version 2 and the key is exactly value.

Meta Pixel Helper is not showing a Purchase event.
Confirm the base code tag (Step 1) is firing. Confirm the trigger Pelcro - Purchase uses event name purchase (lowercase). Verify in GTM Preview that the purchase event fires before the Meta Pixel Purchase tag.

Meta is counting duplicate conversions.
Add a shared eventID using Step 3 to deduplicate browser Pixel and CAPI. Also verify you do not have two GTM tags both firing fbq('track', 'Purchase', ...) on the same trigger.


Frequently Asked Questions

Q1. Does Pelcro automatically send events to GTM?

Not automatically — the bridge script is required. See Google Tag Manager for setup. Once the bridge script is in place, Pelcro's subscription data flows into GTM's dataLayer automatically on every completed subscription.


Q2. Can the subscription event trigger a GA4 purchase conversion?

Yes. Once the bridge script is in place, the purchase event in GTM's dataLayer is in standard GA4 ecommerce format. Create a GA4 Event tag in GTM, trigger it on Pelcro - Purchase, and map the variables directly.

Avoid double-tracking in GA4. If you have enableReactGA4: true in Pelcro UI settings AND a GTM GA4 purchase tag, GA4 counts every transaction twice. Choose one path: Pelcro's built-in GA4 (enableReactGA4: true, no GTM GA4 tag) or GTM-managed GA4 (enableReactGA4 not set, GTM handles it).


Q3. What transaction data is available for the Meta Pixel tag?

FieldGTM variableExample
Amount (decimal){{dlv - value}}26
Currency code{{dlv - currency}}"usd"
Subscription ID{{dlv - transaction_id}}338371
Coupon code{{dlv - coupon}}"PROMO10" or null

All fields are populated by the bridge script via window.dataLayer. Full payload reference in Google Tag Manager.


Q4. What is the recommended setup for Google Ads conversion tracking?

See Google Tag Manager.


Q5. What do I need to set up Meta Pixel?

Two things beyond the standard GTM setup: the Meta Pixel base code tag (Step 1) and the Meta Pixel Purchase tag (Step 2). The bridge script, variables, and trigger are already covered in Google Tag Manager.


Q6. Can Pelcro webhooks support Meta Conversions API?

Yes. Pelcro fires webhooks on subscription.created, subscription.renewed, subscription.canceled, and subscription.expired with email, subscription ID, amount, and currency. Use pelcro-sub-{transaction_id} as the shared event_id. See Step 3.


Q7. Is there a risk of duplicate tracking with GA4?

Yes. If enableReactGA4: true is set and you also have a GTM GA4 purchase tag, GA4 receives the event twice and revenue doubles. Choose one path — Pelcro's built-in GA4 or GTM-managed GA4. Meta Pixel is not affected by this choice.