# Playbook: Google Ads to your own landing page form

Tag your Google Ads links, read the tags on your own page, send the form to Lead through HTTP API with the right channel, and map the fields, with a full example.

Source: https://support.rework.com/article/ads-playbook-google-ads-landing-page

> **In plain words:** You run Google Ads that send people to a page on your own website. On that page they fill in a form. This playbook makes each form answer arrive in the Lead app as a lead, tied to the Google campaign and ad group that brought the person, so AdManager can show leads and cost per lead for each campaign. It covers three parts: the tags you add in Google Ads, what the link looks like after a click and what your form must send, and how the Lead app maps what it receives. New to words such as UTM, click id and attribution? See [Ads basics](https://support.rework.com/article/ads-basics).

**Who this is for:** a marketer running Google Ads, working with the developer who owns the website. The page is built with your own code. If your page is built in Webflow, Unbounce, Wix, Ladipage or HighLevel, use [Playbook: track leads from a landing page](https://support.rework.com/article/ads-playbook-landing-page-tracking) instead.

**What you'll have at the end:** every form submission becomes a lead in the Lead app with the channel **Google Ads**, the Google campaign and ad group, the click id and the UTM tags, and AdManager counts it in the campaign's **Leads** column.

**Time:** 30 to 60 minutes, most of it the developer's part.

## Why this matters

Say you spend 3,000 on a Google Search campaign and 60 people fill in your demo form. Google knows who clicked, and your website knows who filled in the form, but nothing joins the two unless your page passes the click details on. Without them, the Lead app has 60 leads with the channel **Unknown**, and AdManager shows 0 leads and a dash for cost per lead. With them, the same 60 leads count against the right campaign, and the cost per lead is 50.

## Words used in this playbook

- **Landing page:** the page on your own website where the ad sends people.
  
- **Final URL:** the page address you enter on an ad in Google Ads.
  
- **Auto-tagging:** a Google Ads setting that adds a click id (`gclid`) to the Final URL on every click.
  
- **Final URL suffix:** extra tags that Google Ads adds to the end of the Final URL on every click.
  
- **ValueTrack parameter:** a placeholder in curly brackets, such as `{adgroupid}`, that Google replaces with the real value at click time.
  
- **UTM tags:** labels added to a link, such as `utm_source=google`, that say where a visit came from.
  
- **Source:** the entry in the Lead app that receives leads from one place. Here it is an **HTTP API** source.
  
- **Endpoint:** the private web address of that source. Your website sends each form answer to it.
  
- **Channel:** where a lead came from in marketing terms, such as Google Ads or Organic Search. It is set by a field called `lead_channel`.
  
- **Mapping:** telling the Lead app which lead field each form answer belongs in.
  

## Before you start

- Your Google Ads account is connected in AdManager, so its campaigns and spend are synced. See [Connecting ad accounts](https://support.rework.com/article/ads-connecting-ad-accounts).
  
- A lead service exists in the Lead app, and you are an admin there. A **lead service** is the list in the Lead app where leads are kept.
  
- You can edit the ads (or the account settings) in Google Ads.
  
- A developer can change the landing page and the code that runs when the form is submitted.
  

## Steps

### Step 1: Check that auto-tagging is on in Google Ads

Auto-tagging adds the click id `gclid` to every click. The Lead app keeps it on the lead, and it is what matches the lead back to Google. Google turns auto-tagging on by default for new accounts, so it is often on already. Check it once:

1. In Google Ads, click **Admin**, then **Account settings**.
   
2. Open **Auto-tagging** and tick **Tag the URL that people click through from my ad**.
   
3. If it was not ticked, click **Save**.
   

Google help: [About auto-tagging](https://support.google.com/google-ads/answer/3095550).

### Step 2: Add the tags to the Final URL suffix

Google adds `gad_source` and `gad_campaignid` (the campaign id) to every ad click by itself, with no setup. Google help: [About gad\_\* URL parameters](https://support.google.com/google-ads/answer/16193746). Google does not add the ad group id or UTM tags. You add those here. Without this step, the lead still gets its campaign, but not its ad group, keyword or UTM tags.

1. In Google Ads, click **Admin**, then **Account settings**, then **Tracking template**.
   
2. In **Final URL suffix**, paste:
   

```
utm_source=google&utm_medium=cpc&utm_campaign={campaignid}&utm_term={keyword}&gad_adgroupid={adgroupid}
```

Then click **Save**.

To set it for one campaign only: **Campaigns**, **Settings** tab, click the pencil in the **Tracking template** column, fill **Final URL suffix**, **Save**. Google help: [Add a Final URL suffix](https://support.google.com/google-ads/answer/9054021).

What each part does:

| 
Tag

 | 

Value at click time

 | 

What the Lead app does with it

 |
| --- | --- | --- |
| 

`utm_source=google`, `utm_medium=cpc`

 | 

Fixed text

 | 

Saved on the lead as UTM tags

 |
| 

`utm_campaign={campaignid}`

 | 

The campaign id, such as `21234567890`

 | 

Saved on the lead as a UTM tag

 |
| 

`utm_term={keyword}`

 | 

The keyword that matched, on Search ads

 | 

Saved as a UTM tag and shown as **Keyword** on the lead

 |
| 

`gad_adgroupid={adgroupid}`

 | 

The ad group id

 | 

Ties the lead to the Google ad group

 |

`{campaignid}`, `{keyword}` and `{adgroupid}` are Google's ValueTrack parameters. Google help: [Set up tracking with ValueTrack parameters](https://support.google.com/google-ads/answer/6305348). Type them exactly as shown, with the curly brackets. If you type a real id instead, every lead is tied to that one campaign or ad group.

### Step 3: Know what the link looks like after a click

Your Final URL is, for example, `https://www.example.com/demo`. When someone clicks the ad, they land on an address like this (one line, split here to read):

```
https://www.example.com/demo
  ?utm_source=google&utm_medium=cpc&utm_campaign=21234567890
  &utm_term=dental+software&gad_adgroupid=161234567890
  &gad_source=1&gad_campaignid=21234567890
  &gclid=Cj0KCQiA4L67BhDUARIsADWrl7G
```

| 
Part

 | 

Added by

 |
| --- | --- |
| 

`utm_*` and `gad_adgroupid`

 | 

Your Final URL suffix (Step 2)

 |
| 

`gad_source` and `gad_campaignid`

 | 

Google, on every ad click, with no setup

 |
| 

`gclid`

 | 

Google auto-tagging (Step 1)

 |

The order of the tags can differ. That does not matter.

To check it, click one of your own ads (or use the ad preview in Google Ads) and look at the address bar. If you do not see `gclid` and your tags, fix Steps 1 and 2 before going on. A link shortener or a redirect in between can strip the tags, so link straight to the page.

### Step 4: Create an HTTP API source in the Lead app

1. In the Lead app, open **Settings** in the left sidebar, then **Lead sources**. Pick the lead service in the selector at the top.
   
2. On the **Source integrations** tab, click **Connect new**.
   
3. Click **Connect** on **HTTP API**, in the **API** group.
   
4. Type a **Name** you will recognise later, such as "Website: demo page (Google Ads)". Click **Connect**.
   
5. Click the new source's name. On the **Details** tab, copy the **Endpoint**. It looks like `https://your-lead-domain/webhook/incoming/YOUR_TOKEN/lead`.
   

![The Details tab of an HTTP API source in the Lead app](https://storage.googleapis.com/reworkv3-public/success/261125/R4uKW24fTZFwz42zIg9UDdU9yJkgGMPBvgn7CPFwFPnSe77ix55qbWZZI1kJ3GRQ/img.7I7PDXH7n9UHA1Lt1lSOlqom9ryYTKtQmYCEs46P4OrmvKl5nlBDAsUyPbu3D4Wu.png)

> **Important:** the endpoint holds a secret token. Anyone who has it can create leads in your service. Keep it in your website's server code, not in the page that visitors download. If it leaks, use **Regenerate token** in the source's row menu.

### Step 5: Make the form send the page address and the channel

This is the developer's part. When the visitor submits the form, your website's server sends one request to the endpoint. The request must carry two things besides the answers:

- **`referral_url`:** the full address of the page, with all its tags, exactly as in the address bar. The Lead app reads `gclid`, `gad_campaignid`, `gad_adgroupid` and the `utm_*` tags out of it by itself.
  
- **`lead_channel`:** the channel code. For an HTTP API source, the channel comes only from this field. The Lead app does not work it out from `gclid` or the UTM tags here. Without `lead_channel`, the channel is **Unknown**.
  

**1\. On the page, keep the address in a hidden field.** Add this inside the form:

```
<input type="hidden" name="referral_url" id="referral_url">
<script>document.getElementById('referral_url').value = window.location.href</script>
```

If the visitor moves to another page of your site before filling in the form, the tags are lost. In that case, save `window.location.href` when they first arrive (for example in the browser's session storage) and put that value in the field.

**2\. On your server, choose the channel.** Not every visitor comes from an ad, so set `lead_channel` from the address:

- the address contains `gclid=` or `gad_source=`: send `GOOGLE_ADS`
  
- otherwise: send `DIRECT`, or another channel code that fits
  

The code for each channel is shown next to its name in the Lead app, under **Settings**, **Lead sources**, **Source channels**.

**3\. Send the request.** A POST with a JSON body:

```
POST https://your-lead-domain/webhook/incoming/YOUR_TOKEN/lead
Content-Type: application/json

{
  "ext_id": "demo-form-10482",
  "name": "Alex Morgan",
  "email": "alex@example.com",
  "phone": "+15551234567",
  "company_size": "11-50",
  "lead_channel": "GOOGLE_ADS",
  "referral_url": "https://www.example.com/demo?utm_source=google&utm_medium=cpc&utm_campaign=21234567890&utm_term=dental+software&gad_adgroupid=161234567890&gad_source=1&gad_campaignid=21234567890&gclid=Cj0KCQiA4L67BhDUARIsADWrl7G"
}
```

- `ext_id` is your own id for the submission. If the same `ext_id` arrives twice, the Lead app keeps one lead.
  
- Each lead needs at least a name, an email, a phone number or an `ext_id`, or it is rejected.
  
- A form post (`application/x-www-form-urlencoded`) with the same keys works too.
  

The reply to a saved lead is `{"ok": true, "lead_id": "...", "deduped": false}`. A rejected lead also gets a 200, with `"ok": false`, so always check `ok`. All replies and the bulk address are in [Website forms, webhooks and Zapier](https://support.rework.com/article/lead-webhooks).

### Step 6: Send a test and map the fields

1. Open your page through a real ad click, or paste the tagged address from Step 3 into the browser.
   
2. Fill in the form with a made-up person and submit it.
   
3. In the Lead app, open the source, then click **Transform fields**. It lists the keys it received.
   
4. Click **Auto Map Fields** (1). A message says how many fields were mapped. Every key whose code matches a lead field is paired with it (2), such as `name`, `email`, `phone`, and `company_size` with **Number of employees** when that field's code is `company_size`. Rows for the UTM tags can appear too. Keep them.
   
5. If a key has no matching lead field, pick an existing field for it, or click **New field** under **Destination fields** to create one.
   
6. Click **Validate**, then **Save** (3).
   

![The Transform fields tab of the HTTP API source after a test](https://storage.googleapis.com/reworkv3-public/success/261125/kZkNoLbQkit4jmClgUKjBv8VrWgsgatkwF34IYl5qkzjqG8fBDe6b5sCSd0QHrk3/img.ClSflwdBzoFj4N8QcCpomhLl6iJ5xL8qqeWhMBOUDWy2wgAn6aqWY5Xym14wlYbV.png)

You do not need rows for the other tracking keys. `referral_url`, `lead_channel`, `gclid`, `gad_campaignid` and `gad_adgroupid` are read by the Lead app on its own, whichever **Incoming fields** mode you use. Mapping changes apply to new leads only, so send one more test after saving. More on mapping: [Mapping a source's fields](https://support.rework.com/article/lead-mapping-source-fields).

How the example request lands:

| 
Key sent

 | 

Where it ends up in the Lead app

 |
| --- | --- |
| 

`name`, `email`, `phone`

 | 

The lead's name, email and phone

 |
| 

`ext_id`

 | 

The lead's external id, used to avoid duplicates

 |
| 

`company_size`

 | 

The lead field you mapped it to

 |
| 

`lead_channel`

 | 

The channel: Google Ads

 |
| 

`referral_url`

 | 

**Referral** in **Source & Attribution**

 |
| 

`utm_*` (inside `referral_url`)

 | 

The UTM lines in **Source & Attribution**

 |
| 

`gclid` (inside `referral_url`)

 | 

The `gclid` click id in **Source & Attribution**

 |
| 

`gad_campaignid`, `gad_adgroupid` (inside `referral_url`)

 | 

**Campaign** and **Ad set** under **Ad attribution** (for Google, **Ad set** is the ad group)

 |
| 

`utm_term` (inside `referral_url`)

 | 

**Keyword** under **Ad attribution**

 |

## Check it worked

1. In the Lead app, open the test lead.
   
2. In the **Source & Attribution** panel, check:
   
   - the source is your HTTP API source (1)
     
   - **First touch** and **Last touch** show **Paid Marketing** (2), the group the Google Ads channel belongs to
     
   - under **Ad attribution** (3), **Campaign** and **Ad set** show your Google campaign and ad group (a name appears once the account has synced, otherwise the id), and **Keyword** shows the search keyword
     
   - the UTM lines and the `gclid` click id are filled (4)
     

![The Source & Attribution panel of a test lead in the Lead app](https://storage.googleapis.com/reworkv3-public/success/261125/7ScyvipHei1QRLbwobzPUomjQhqneiwlxVJ6PfTBN9qksr18QAcZI5lpdki82M4L/img.n5rlukZpeun0wnbCTxmUk8LQNOqyWOc46NHdingwmfkYCzDD9F1Ozeq0yXw7k3pz.png)

Then, in AdManager, after the next sync, open **Campaigns** and scroll right past **Spend**. The campaign's **Leads** column counts the lead. Click the number to see the leads behind it. See [Connecting to the Lead app](https://support.rework.com/article/ads-connecting-to-other-apps).

## Troubleshooting

| 
Problem

 | 

Why it happens

 | 

What to do

 |
| --- | --- | --- |
| 

The channel is **Unknown**, even though `gclid` is on the link

 | 

HTTP API sources take the channel only from `lead_channel`.

 | 

Send `lead_channel` (Step 5).

 |
| 

Every lead is Google Ads, even people who did not click an ad

 | 

`lead_channel` is always set to `GOOGLE_ADS`.

 | 

Set it from the address: `GOOGLE_ADS` only when `gclid` or `gad_source` is there.

 |
| 

**Referral**, UTM and `gclid` are empty

 | 

The request does not carry `referral_url`, or it carries the address without its tags.

 | 

Send the full `window.location.href`, from the hidden field.

 |
| 

The address bar has no `gclid` after a click

 | 

Auto-tagging is off, or a redirect or link shortener strips the tags.

 | 

Turn on auto-tagging (Step 1). Link straight to the page.

 |
| 

**Ad set**, **Keyword** and the UTM lines are empty, but **Campaign** is filled

 | 

The Final URL suffix is missing. Google adds the campaign id on its own, but not the rest.

 | 

Add the suffix (Step 2).

 |
| 

Every lead shows the same campaign or ad group

 | 

A real id was typed in the suffix instead of `{campaignid}` or `{adgroupid}`.

 | 

Use the ValueTrack parameters with curly brackets.

 |
| 

Leads arrive, but **Leads** in AdManager stays 0

 | 

The Google Ads account is not connected or not synced yet, or the lead has no campaign id.

 | 

Check the account in AdManager, then check **Ad attribution** on the lead.

 |
| 

A custom answer is empty on the lead

 | 

The key is not mapped.

 | 

Map it on **Transform fields** (Step 6), then send a new test.

 |
| 

The request gets a 404

 | 

The endpoint is wrong, the token was regenerated, or the source is disconnected.

 | 

Copy the endpoint again from the source.

 |
| 

Two leads for one submission

 | 

The form sent twice, without the same `ext_id`.

 | 

Send a stable `ext_id`. See [Avoiding duplicate leads](https://support.rework.com/article/ads-avoiding-duplicate-leads).

 |
