Google Ads
Google Ads is Google's comprehensive advertising platform, widely used for displaying ads across various tools and websites. The walker.js Google Ads destination enables seamless integration of your web application with Google Ads, facilitating effective tracking and management of conversion events.
Configuration
Begin by configuring the destination settings. The destination can be utilized in both a Node environment and directly in the browser.
const config = {
custom: {
conversionId: 'AW-123456789', // Required
currency: 'EUR',
defaultValue: 1,
},
mapping: {
// e.g. order
entity: {
// e.g. complete
action: {
custom: {
label: 'abc', // Required
id: 'order_id',
value: 'revenue',
},
},
},
},
};
Custom
Property | Type | Description |
---|---|---|
conversionId* | string | The Ads account ID used for every conversion. |
currency | string | The default currency for conversions. |
defaultValue | number | Default value used for conversions. |
CustomEvent
For the custom event mapping (mapping.entity.action.custom
):
Property | Type | Description |
---|---|---|
label* | string | Conversion label. |
id | string | Property key to use as a transaction ID. |
value | string | Name of the data property key to use for value. |
How to use
First, define the config that you want to use for the destination:
const config = {
custom: {
conversionId: 'AW-123456789',
},
mapping: {
order: {
complete: {
custom: {
label: 'abc',
},
},
},
},
};
This will send a conversion event to Google Ads for the order complete
event.
Choose one of the following installation options to use the destination:
- TypeScript
- Script
- Code
Install the destination via npm
npm i @elbwalker/destination-web-google-ads
import { elb } from '@elbwalker/walker.js';
import destinationGoogleAds from '@elbwalker/destination-web-google-ads';
elb('walker destination', destinationGoogleAds, config);
Loading the destination via dynamic import
<script>
// Upload the dist/index.mjs on your own server
const destination = (
await import(
'https://cdn.jsdelivr.net/npm/@elbwalker/destination-web-google-ads/dist/index.mjs'
)
).default;
elb('walker destination', destination, config);
</script>
Copy the code from the index.browser.js file
(function () {
'use strict';
var Destination = (() => {})(); // This is the copied code
elb('walker destination', Destination.default, config);
})();