Skip to content

Instantly share code, notes, and snippets.

@Dan0sz
Last active October 30, 2023 20:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Dan0sz/2ad15f5f75df2eda9eddc97281b8c515 to your computer and use it in GitHub Desktop.
Save Dan0sz/2ad15f5f75df2eda9eddc97281b8c515 to your computer and use it in GitHub Desktop.
Track Google Ads conversions with CAOS for WordPress
<?php
/**
* @formatter:off
* Plugin Name: Google Ads for CAOS
* Plugin URI: https://daan.dev/google-adwords-caos/
* Description: Track Google Ads conversions with CAOS.
* Version: 1.0.0
* Author: Daan van den Bergh
* Author URI: https://daan.dev
* License: GPL2v2 or later
* @formatter:on
*/
if (!defined('ABSPATH')) {
exit;
}
/**
* Replace 'YOUR-ADS-ID' with, well, your Google Ads ID.
*/
function caos_google_ads()
{
$adsId = 'YOUR-ADS-ID'; // Starts with AW-
add_filter(
'caos_gtag_additional_config',
function() use ($adsId) {
return "gtag('config', '$adsId');";
}
);
}
add_action('caos_process_settings', 'caos_google_ads');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment