This guide covers how to send Locally purchase events to Meta (Facebook) Ads Manager using GTM. When complete, every order placed through the Locally widget will fire a custom LocallyPurchase event to your Meta Pixel — visible in Events Manager and usable for custom conversions and campaign optimization.
Prerequisite: Complete the SwitchLive GTM Core Setup first. The Data Layer Variables and SwitchLive Event Listener from that guide are required here.
Why
trackCustomand nottrack: We firefbq('trackCustom', 'LocallyPurchase', ...)instead offbq('track', 'Purchase', ...). Using the standardPurchaseevent would merge Locally orders with your existing D2C purchase tracking, inflating purchase counts and disrupting campaign optimization. The custom event keeps Locally data separate and attributable.
Step 1: Create a Product Price (Number) Variable
Meta requires the value parameter to be a number. The product_price field from SwitchLive comes through as a string (e.g., "1899.99" with quotes). This Custom JavaScript variable converts it to a clean numeric value.
- In GTM, go to Variables > New > Variable Configuration > Custom JavaScript.
- Paste the following:
function() {
return parseFloat({{SwitchLive - Product Price}}) || 0;
}- Name the variable SwitchLive - Product Price (Number) and save.
Note: This variable is also required for the Google Ads integration. Create it once and reuse it in both places.
Step 2: Create an Order Placed Trigger
The Meta tag should only fire when an order is completed — not on every SwitchLive event. The event_description field identifies Order Placed events.
- Go to Triggers > New > Trigger Configuration > Custom Event.
- Set Event Name to
SwitchLiveEvent. - Check Some Custom Events (rather than All Custom Events).
- Set the condition:
event_descriptionequalsModal - Order Placed. - Name the trigger SwitchLive - Order Placed Trigger and save.
Note: This same trigger is used for the Google Ads integration. Create it once and reuse it.
Step 3: Create the Meta Custom Event Tag
- Go to Tags > New > Tag Configuration > Custom HTML.
- Paste the following (including
<script>tags):
<script>
fbq('trackCustom', 'LocallyPurchase', {
value: parseFloat({{SwitchLive - Product Price (Number)}}),
currency: 'USD',
content_ids: [{{SwitchLive - Product ID}}],
content_type: 'product',
sale_type: {{SwitchLive - Sale Type}},
store_name: {{SwitchLive - Store Name}},
order_scope: {{SwitchLive - Scope}}
});
</script>- Assign the SwitchLive - Order Placed Trigger.
- Name the tag Locally Meta Event Tag and save.
Currency: Update
'USD'if your store operates in a different currency.
Step 4: Publish the GTM Container
Before testing, publish your GTM workspace so the tags are live on your site.
- In GTM, click Submit.
- Add a version description (e.g., "SwitchLive Meta integration") and click Publish.
Step 5: Create a Custom Conversion in Meta Ads Manager
Once the LocallyPurchase event has fired at least once (from a test order), you can create a custom conversion to track it for reporting and optimization.
- Go to Meta Ads Manager > Events Manager > Custom Conversions > Create Custom Conversion.
- Configure as follows:
- Name: Locally Purchase (or your preferred naming convention)
- Data source: Your site's pixel
- Action source: Website
- Event: Select
LocallyPurchasefrom the dropdown - Standard event for optimization: Purchase
- Rules: Set URL contains
yourdomain.com— this satisfies Meta's required field. SinceLocallyPurchaseonly fires on completed Locally orders, no further filtering is needed. - Value: Toggle on Use a value from event — Meta will pull the
valueparameter automatically.
- Click Create.
Timing:
LocallyPurchasewill appear in the Event dropdown only after it has fired at least once. Meta typically takes 24–48 hours to populate new custom events in the dropdown. If you don't see it yet, wait and check back.
Step 6: Test the Integration
Confirm the tag fires in GTM Preview
- Open GTM in Preview mode and navigate to your site.
- Complete a test order through the Locally widget (use a test store and test credit card if available — contact your Locally Implementation Manager to set one up).
- In Tag Assistant, find the SwitchLiveEvent entry where
event_description=Modal - Order Placed. - Confirm the Locally Meta Event Tag fired.
- Check the tag details and confirm:
valueshows the actual numeric price (e.g.,1899.99), not the variable name as text.content_idsshows the product ID.sale_typeshowsBOPISorROPIS.
Confirm the event appears in Meta Events Manager
- Go to Meta Ads Manager > Events Manager > Datasets > [Your Pixel] > Test Events.
- Keep the Test Events tab open before placing the test order — the tab only captures events in real time while it's open.
- Place a test order through the widget.
- Look for
LocallyPurchasein the event stream with the correctvalue,currency,content_ids,sale_type, andstore_nameparameters.
Troubleshooting
"Invalid LocallyPurchase Value Parameter" warning in Events Manager
Meta is receiving product_price as a string instead of a number. Confirm you're using {{SwitchLive - Product Price (Number)}} (the Custom JavaScript variable from Step 1) as the value in your tag — not {{SwitchLive - Product Price}} (the raw DLV, which returns a string).
LocallyPurchase event not appearing in Events Manager
- Make sure the Test Events tab was open before you placed the order.
- Confirm the GTM container is published (Preview mode uses unpublished changes; Events Manager captures live traffic).
- Check Tag Assistant to verify the Locally Meta Event Tag fired on the Order Placed event. If it didn't fire, check the trigger condition —
event_descriptionmust equalModal - Order Placedexactly.
LocallyPurchasenot showing in the Custom Conversion event dropdown
This is expected if the event has fired fewer than a few times or was first fired within the last 24–48 hours. Meta needs time to register new custom events. Check back the next day.
Multiple pixels in Events Manager
If your site loads more than one Meta pixel, LocallyPurchase will only appear under the pixel that your GTM tag is associated with. Confirm you're checking the correct dataset.
For additional assistance, reach out to your Implementation Manager or CSM.

