> For the complete documentation index, see [llms.txt](https://docs.growsurf.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.growsurf.com/integrations/meta-ads.md).

# Meta (Facebook) Ads

Retarget referred visitors and track referral events in Meta (Facebook) Ads to optimize your ad campaigns.

## How It Works <a href="#sync-with-your-activecampaign-list" id="sync-with-your-activecampaign-list"></a>

The Meta Ads integration lets you retarget website visitors who arrive through referral links and track their conversions when they submit their email addresses on your website.

{% hint style="success" %}
Under the hood, GrowSurf loads the Meta Ads library (Facebook script) for event tracking. If Meta Ads is already installed, GrowSurf does not load it again.
{% endhint %}

***

## How to Set Up

**Step 1**: In *Program Editor > 4. Options > Integrations*, open the Meta Ads integration card and enter your [Meta Ads pixel ID](https://www.facebook.com/business/help/171689010314963).

{% hint style="info" %}
**Note:** If Meta Ads (as a Facebook pixel) is already on your site, you can skip the Meta Ads pixel ID and press *Connect*. We still recommend entering it for pages that do not have Meta Ads installed.
{% endhint %}

<figure><img src="https://2794996218-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LeklWo0yn03AhWro2Ux%2Fuploads%2F0nO8lHjAJX5v6cLkIBOj%2Fimage.png?alt=media&amp;token=69f35046-79a9-40b9-bd28-d054b1928e6f" alt=""><figcaption></figcaption></figure>

**Step 2:** Once connected, GrowSurf will have all events enabled by default. Disable any events that you do not want to track.

{% hint style="danger" %}
**Important Note**: Make sure that your Share URL (found in the *Program Editor > 5. Installation* step) is a part of your Meta Ads account. If you are using multiple domains, within Meta Ads manager, you may need to enable **Automatic Advanced Matching** and set up **Domain Verification** to avoid issues with shared traffic between domains.
{% endhint %}

**Step 3:** In your Meta Ads account, you will need to add the following two custom conversions (You can skip this step if you have both "Track conversion event" checkboxes toggled off). Follow the instructions in [How to Add Custom Conversions In Meta Ads](#how-to-add-custom-conversions-in-meta-a-ds).

* `growsurf_referral_signup` - This conversion event represents when a referred visitor submits their email address on the form on your website that has referral tracking on it.
* `growsurf_referral_trigger` - This conversion event represents when a participant completes a qualifying action, like making a purchase (Note: this only applies when you are using [`growsurf.triggerReferral()`](https://docs.growsurf.com/developer-tools/javascript-sdk/api-reference#trigger-referral)from the front-end).

***

## How to Add Custom Conversions In Meta Ads

<details>

<summary>Open instructions</summary>

1. Log into your [Meta Ads Manager account](https://adsmanager.facebook.com/adsmanager).
2. From the left-side menu, navigate to *All tools > Advertise > Events Manager* (see image below)*.*

   <figure><img src="https://2794996218-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LeklWo0yn03AhWro2Ux%2Fuploads%2FcrdwLZ09leoPPFk8PPYz%2Fimage.png?alt=media&amp;token=0e705e4b-426c-44de-8053-da679539b7c7" alt=""><figcaption></figcaption></figure>
3. Choose the pixel ID that you entered for the Meta Ads integration within GrowSurf (see image below).

   <figure><img src="https://2794996218-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LeklWo0yn03AhWro2Ux%2Fuploads%2FSiGHnC1MnzaoxQHKYwe2%2Fimage.png?alt=media&amp;token=0a96a334-9346-45f2-9581-b33a1bbf7dfa" alt=""><figcaption></figcaption></figure>
4. You should now be seeing a page called "Data Sources". Click the top-right *Create* button and choose "Create custom conversion" from the dropdown (see image below).

   <figure><img src="https://2794996218-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LeklWo0yn03AhWro2Ux%2Fuploads%2FhclyEDK7uJdAKoHawxA8%2Fimage.png?alt=media&amp;token=75a813e8-a8ad-4f23-8276-9ecb1451dd6c" alt=""><figcaption></figcaption></figure>
5. You should be seeing a popup window with the title "Create a custom conversion". For the Name field, enter the following conversion name depending on which conversion event you're adding:
   1. `growsurf_referral_signup`
   2. `growsurf_referral_trigger`
6. For the Data source field, make sure to keep the same pixel ID you chose from step 3 selected.
7. For the Action Source field, keep "Website" selected.
8. For the Event field, choose one of the following:
   1. For `growsurf_referral_signup`, we recommend using "Lead" (or choose a different category that best represents a referred visitor signing up).
   2. For `growsurf_referral_trigger`, we recommend using "Add payment info" (or choose a different category that best represents when a referred participant completes a qualifying action, which triggers a referral).
9. In the first Rules dropdown, select "Event Parameters". Then in the second Rules field, type in `source`. For the third Rules field, select "equals". Then in the fourth Rules field, enter `growsurf`. Your screen should now look like the image below:

   <figure><img src="https://2794996218-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LeklWo0yn03AhWro2Ux%2Fuploads%2F845cUid3Lkul5BLpKKc0%2Fimage.png?alt=media&amp;token=6a291365-842c-4645-8750-798315b6f744" alt=""><figcaption></figcaption></figure>
10. For the other fields like Description and Conversion value, you can adjust to your preferences.
11. Click the *Create* button.
12. Make sure that you repeat steps 1-11 above for `growsurf_referral_trigger` as well.

</details>

***

## **Troubleshooting Tips** <a href="#troubleshooting-tips" id="troubleshooting-tips"></a>

Here are common scenarios and how to troubleshoot them.

#### If Meta Ads events are NOT occurring, but you were expecting them:

* Make sure you do not have any ad-blockers or browser extensions blocking requests to Meta Ads.
* Make sure your Share URL (and the page where the referral submits their email address, if you are tracking conversions) is a part of your Meta Ads account. You can find the Share URL in the *Program Editor > 5. Installation* step. In your Meta Ads account, you may need to enable **Automatic Advanced Matching** and set up **Domain Verification** to avoid issues with shared traffic between domains.
* If you are testing conversions being tracked, make sure that you've allowed up to 30 minutes for Meta Ads to process the events.
* To check whether the Meta (Facebook) Ads script is loading on your website, open a participant's referral link first. The script loads only after that.

#### If Meta Ad events are occurring, but you were NOT expecting them:

* To stop GrowSurf from loading Meta Ads, disconnect the integration. Turning off every event is not enough.
* If you see Meta Ads network requests being made on your website and you have the integration completely disabled, GrowSurf may not be emitting these events. Check other parts of your code to find where these events might be happening.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.growsurf.com/integrations/meta-ads.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
