> For the complete documentation index, see [llms.txt](https://docs.adpage.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.adpage.io/integrations-websites/woocommerce/generate_lead-webhooks-contactform7-and-gravityforms.md).

# generate\_lead webhooks (Contactform7 & GravityForms)

Alongside your regular tracking, the generate\_lead webhooks arriving at your server container can be passed on to n8n, Zapier or Make and used anywhere downstream.

When someone fills in a form on your WordPress site, that submission is worth more than a name and an email address. AdPage also knows where the visitor came from: the campaign, the click ID, the landing page, the session. This guide shows you how to forward all of it from your Google Tag Manager server container to a platform of your choice, so your CRM or automation flow receives the lead *and* the story behind it.

{% hint style="info" %}
This only works with Gravity Forms or Contact Form 7 on WordPress. Other CMS platforms aren't supported by this feature.
{% endhint %}

<figure><img src="https://1274044937-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FA65KwL1NwewlJbtCXsXd%2Fuploads%2FJeKZbhjdzEUWSFRpLBjP%2Fimage.png?alt=media&amp;token=3531f4a7-7e92-48c4-967c-12bd06ca5c0b" alt=""><figcaption></figcaption></figure>

### What gets sent along in the webhook

**The lead itself**

* Form fields such as name, email address and phone number
* The page the conversion happened on, plus a timestamp
* Behavioural data from the session

**The marketing attribution**

* UTM parameters: `utm_source`, `utm_medium`, `utm_campaign`, `utm_term`, `utm_content`
* Click and browser IDs: `gclid` (Google), `fbc` / `fbp` (Meta), `ttclid` (TikTok)
* Session data: session ID, session count, user agent
* Traffic source: referrer URL and landing page

Once the webhook client has done its work, the payload looks roughly like this:

```json
{
  "event_name": "trytagging_generate_lead",
  "form_data": {
    "name": "John Doe",
    "email": "john-doe@example.com",
    "phone": "+31612345678"
  },
  "marketing": {
    "utm_source": "google",
    "utm_medium": "cpc",
    "utm_campaign": "summer-sale",
    "gclid": "abc123...",
    "fbp": "fb.1.1234567890",
    "user_agent": "Mozilla/5.0...",
    "ip": "192.168.1.1"
  },
  "user_data": {
    "first_name": "John",
    "last_name": "Doe",
    "email": "john-doe@example.com",
    "phone": "+31612345678"
  }
}
```

### Before you start

Make sure you have:

* [ ] A configured Google Tag Manager server-side container
* [ ] The AdPage tracking implementation running on your WordPress site
* [ ] A webhook endpoint from the platform you want to send to (n8n, Zapier or Make)

### Step 1: Add the webhook client

The client is what listens for incoming lead data and turns it into the structured payload shown above.

1. Download the [AdPage Webhook client](https://claude.ai/chat/7a409d3e-4dd5-4870-a74b-b264e50d8632#) from GitHub.
2. In your GTM server container, go to **Templates**, create a new **client template**, and import the `.tpl` file you just downloaded.
3. Go to **Clients**, create a new client, choose **AdPage Webhook Client** as the client configuration, and save.

That's it for the client. It parses the incoming request automatically, so there's nothing to configure inside it.

### Step 2: Create the HTTP request tag

This tag does the actual sending.

1. Go to **Templates** and search the gallery for the **JSON HTTP Request** tag template. Add it to your workspace.

<figure><img src="https://1274044937-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FA65KwL1NwewlJbtCXsXd%2Fuploads%2FWeFcfld7u6yhz1YLabH3%2Fimage.png?alt=media&amp;token=4cfb5125-b8b4-42d6-a849-28dd302754ac" alt=""><figcaption></figcaption></figure>

2. Create a new tag and select that template as its tag configuration.
3. Fill in the fields:

<table><thead><tr><th width="239">Field</th><th>Value</th></tr></thead><tbody><tr><td>URL</td><td>Your webhook endpoint (n8n, Zapier or Make)</td></tr><tr><td>Request Data</td><td><p><code>form_data</code> → Event Data variable <code>{{form_data}}</code> </p><p></p><p><code>marketing</code> → Event Data variable <code>{{marketing}}</code></p></td></tr><tr><td>Method (under <em>Additional Options</em>)</td><td><code>POST</code></td></tr></tbody></table>

<figure><img src="https://1274044937-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FA65KwL1NwewlJbtCXsXd%2Fuploads%2FqIQP4xW9apSL3PXPh4LV%2Fimage.png?alt=media&amp;token=132ce7d6-50f1-4ded-87d3-a57f697597f6" alt=""><figcaption></figcaption></figure>

### Step 3: Add the trigger

The tag needs to fire only when lead data actually comes in.

1. In the tag configuration, click **Triggering** and then the blue plus icon at the top right.
2. Choose **Custom** as the trigger type, then select **Some Events**.
3. Add these two conditions:
   * `{{Client Name}}` **equals** `AdPage Webhook Client`
   * `{{Event Name}}` **equals** `trytagging_generate_lead`
4. Save the trigger, then save the tag.

<figure><img src="https://1274044937-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FA65KwL1NwewlJbtCXsXd%2Fuploads%2F4I6C1MyWvK5RDB02u8Eb%2Fimage.png?alt=media&amp;token=87f6a511-eb63-4f95-abbd-776cf23e43e9" alt=""><figcaption></figcaption></figure>

### Test it with a webhook replay

You don't need to wait for a real form submission. Any webhook that already arrived can be replayed straight into preview mode.

1. Open your server container in the AdPage platform and go to **Webhook Logs**.
2. Find a `generate_lead` webhook and click the circular double-arrow icon to replay it. A popup asks for a preview header.
3. To get that header: open the same server container in GTM, switch to **Preview** mode, click the three dots at the top right and choose **Send requests manually**.
4. Copy the `x-gtm-server-preview` header, paste it into the replay popup, and click **Replay**

<figure><img src="https://1274044937-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FA65KwL1NwewlJbtCXsXd%2Fuploads%2Fs4EmltpKJOVQYiXUm3SC%2Fimage.png?alt=media&amp;token=03b44252-7302-4a45-a48d-cebef116ffb1" alt=""><figcaption></figcaption></figure>

A `trytagging_generate_lead` request now appears in your preview window and the JSON HTTP Request tag should show as fired. Open the tag and check that `form_data` and `marketing` are both populated. If they are, you're done.

### When something doesn't work

**The tag doesn't fire**

Check the trigger conditions first, especially whether the event name matches exactly. Then confirm the client is saved and active in the container.

**The tag fires but data is missing**

Look at your variable configuration and your data layer implementation. If `marketing` comes through empty, the attribution data likely isn't being captured on the website side.

**The receiving platform rejects the request**

Check the webhook URL format, any authentication headers the platform requires, and whether it expects a specific payload structure.

**Debugging tips**

* Set the log type to *Always log to console* while you're testing.
* Add a trace ID header so you can follow a single request end to end.
* Start with the basics and add fields once those arrive correctly.
* Watch for a `200 OK` response; anything else is worth investigating.

### Keeping it secure

Send only the fields you actually need, and use an HTTPS endpoint. Where your platform supports it, enable webhook signature verification and set proper authentication headers. If the payload contains sensitive personal data, consider encrypting it and restrict who can reach the endpoint.

### A few good habits

Configure timeout and retry logic so a temporary outage doesn't cost you leads, validate data before sending it, and set up an alert for failed webhooks. Document your field mappings somewhere your future self can find them, and retest after any change to the form or the container.


---

# 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 dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.adpage.io/integrations-websites/woocommerce/generate_lead-webhooks-contactform7-and-gravityforms.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
