# Google Ads Integration - Web SDK

For integrating with Google Ads, we recommend using the direct method with Web SDK instead of the redirect method. Utilize the advertiser's link in the tracking template field within Google Ads to seamlessly track conversions in Offer18 with Web SDK. This approach enhances accuracy and efficiency in monitoring your ad performance.

### Create Campaign

1. Create Offer Using Advertiser's Link in Offer18
2. Fetch Affiliate Tracking URL or Impression URL and remove the Affiliate ID `(&a=0000)`&#x20;

{% code overflow="wrap" %}

```
Example Tracking URL : https://example.o18.link/c?o=0000000&m=0000
Example Impression URL : https://example.o18.link/i?o=0000000&m=0000
```

{% endcode %}

3. Use this URL in Web SDK

#### Create Campaign at Google Ads&#x20;

1. Sign in to Google Ads Account
2. Click on "**+ NEW CAMPAIGN**" to create a new campaign
3. Select Campaign Objective Like - **Sales, Leads, Website traffic,** etc.&#x20;
4. Define **Campaign Name, Targeting, and budget**
5. Define **ad groups** and **keywords**
6. Create ads **» Ad URL Options**
7. Place **Advertiser URL** in "**Tracking Template**"

{% hint style="warning" %}

#### **Modify Advertiser URL Before Adding in Tracking Template**

You should include the Affiliate ID as a query parameter in the advertiser's URL. The parameter key used here will be used in the Web SDK to retrieve the Affiliate ID.
{% endhint %}

{% code title="Example Advertiser URL" %}

```
https://example.com?<YOUR-PARAMETER-KEY>=00000
```

{% endcode %}

8. Add URL Suffix (If any)
9. Go to "Save ad"

#### [<mark style="color:blue;">**Learn more about creating a campaign at Google Ads**</mark>](https://knowledgebase.offer18.com/affiliate/google-ads-integration#create-campaign)

***

## Advertiser Side Integration

When setting up the integration on the advertiser's side, configure WebSDK using the data Tracking link.

To start tracking with Offer18's web SDK, one needs to add a script tag in the website.

<mark style="color:purple;">Placement : Header (All Pages)</mark>

{% code fullWidth="false" %}

```html
<script src="https://web-resources.offer18.net/sdk/web/WebSDK.js"></script>
```

{% endcode %}

### Track Clicks

To track clicks using the SDK, add the following code to your script.

<mark style="color:purple;">Placement : Header (All Pages)</mark>

{% code fullWidth="false" %}

```html
<script>
    window.Offer18WebSDK.trackClick({
        trackingURL: '<YOUR-TRACKING-LINK>',
        keymapping: ['a:<YOUR-PARAMETER-KEY>']
    });
</script>
```

{% endcode %}

{% tabs %}
{% tab title="Object Configuration - window\.Offer18WebSDK.trackclick()" %}

1. **trackingURL** (Mandatory) : Replace `<YOUR-TRACKING-LINK>` with the Tracking URL without Affiliate ID
2. **keymapping** : Replace `<YOUR-PARAMETER-KEY>` with the parameter key which was used in Google Ads to pass Affiliate ID
   {% endtab %}
   {% endtabs %}

### Track Impressions

To track Impression using the SDK, add the following code to your script.

<mark style="color:purple;">Placement : Header (All Pages)</mark>

{% code fullWidth="false" %}

```html
<script>
    window.Offer18WebSDK.trackClick({
        impressionURL: '<YOUR-IMPRESSION-LINK>',
        keymapping: ['a:<YOUR-PARAMETER-KEY>']
    });
</script>
```

{% endcode %}

{% tabs %}
{% tab title="Object Configuration - window\.Offer18WebSDK.trackclick()" %}

1. **impressionURL** (Mandatory) : Replace `<YOUR-TRACKING-LINK>` with the Impression URL without Affiliate ID&#x20;
2. **keymapping** : Replace `<YOUR-PARAMETER-KEY>` with the parameter key which was used in Google Ads to pass Affiliate ID
   {% endtab %}
   {% endtabs %}

### Track Conversions

Advertiser must add the following code snippet into all landing pages except Order confirmation / Order Success (Thank you) page.

<mark style="color:purple;">Placement : Thank you Page/Order Success Page (One Page)</mark>

```html
<script>
    window.Offer18WebSDK.trackConversion({
        domain: '',
        accountId: '',
        offerId: '',
        coupon:'',
        postbackType: '', // 'iframe' or 'pixel'
        isGlobalPixel: false, // true or false
        allowMultiConversion: false, // true or false
        conversionData: {
            event: '', // Event Name (Please specify the event)
            payout: '', // Payout Amount (Please specify the payout amount)
            sale: '', // Sale Amount (Please specify the sale amount)
            currency: '',
            adv_sub1: '',
            adv_sub2: '',
            adv_sub3: '',
            adv_sub4: '',
            adv_sub5: '',
        }
    })
</script>
```

Click the link below to know more about Offer18's Web SDK

{% content-ref url="../../network/sdk/web-sdk" %}
[web-sdk](https://knowledgebase.offer18.com/network/sdk/web-sdk)
{% endcontent-ref %}


---

# Agent Instructions: 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:

```
GET https://knowledgebase.offer18.com/affiliate/integration/google-ads-integration-web-sdk.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
