From 98e184767d15c2d16d573d44af98247ab9c798e7 Mon Sep 17 00:00:00 2001 From: Robert O'Rourke <23417+roborourke@users.noreply.github.com> Date: Wed, 24 Jan 2024 17:27:43 +0000 Subject: [PATCH 1/5] Fix integration with tag manager Since tag manager was removed with v17 in the analytics module this consent API integration has been broken because the inline script never got added. It's fine to just enqueue all the time now, if there's no tag manager loaded on the page then it just won't do anything. --- inc/gtm/namespace.php | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/inc/gtm/namespace.php b/inc/gtm/namespace.php index 4fd9a56..037c4d3 100644 --- a/inc/gtm/namespace.php +++ b/inc/gtm/namespace.php @@ -7,20 +7,10 @@ namespace Altis\Privacy\GTM; -use Altis; - /** * Kick it off. */ function bootstrap() { - $config = Altis\get_config(); - $gtm = $config['modules']['analytics']['google-tag-manager'] ?? ''; - - // Bail if we aren't using GTM. - if ( empty( $gtm ) ) { - return; - } - add_action( 'wp_enqueue_scripts', __NAMESPACE__ . '\\enqueue_scripts', 11 ); } From 87a76dbc59f193dcffa8962276afc80425d96761 Mon Sep 17 00:00:00 2001 From: Robert O'Rourke <23417+roborourke@users.noreply.github.com> Date: Thu, 25 Jan 2024 11:43:57 +0000 Subject: [PATCH 2/5] Remove GTM integration --- inc/namespace.php | 1 - 1 file changed, 1 deletion(-) diff --git a/inc/namespace.php b/inc/namespace.php index 5436b79..3e7ea03 100644 --- a/inc/namespace.php +++ b/inc/namespace.php @@ -12,5 +12,4 @@ */ function bootstrap() { Consent\bootstrap(); - GTM\bootstrap(); } From 9e706fa32bd3c95878147a5e935b6ae25359a3dd Mon Sep 17 00:00:00 2001 From: Robert O'Rourke <23417+roborourke@users.noreply.github.com> Date: Thu, 25 Jan 2024 11:44:27 +0000 Subject: [PATCH 3/5] Delete inc/gtm directory --- inc/gtm/namespace.php | 35 ----------------------------------- 1 file changed, 35 deletions(-) delete mode 100644 inc/gtm/namespace.php diff --git a/inc/gtm/namespace.php b/inc/gtm/namespace.php deleted file mode 100644 index 037c4d3..0000000 --- a/inc/gtm/namespace.php +++ /dev/null @@ -1,35 +0,0 @@ - Date: Thu, 25 Jan 2024 11:45:00 +0000 Subject: [PATCH 4/5] Remove GTM integration autoload --- composer.json | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/composer.json b/composer.json index 55e010f..bef2ac2 100644 --- a/composer.json +++ b/composer.json @@ -16,8 +16,7 @@ "autoload": { "files": [ "inc/namespace.php", - "inc/consent/namespace.php", - "inc/gtm/namespace.php" + "inc/consent/namespace.php" ] }, "extra": { From 92049fc275012d5f28e337dff8e621fe767cf90d Mon Sep 17 00:00:00 2001 From: Robert O'Rourke <23417+roborourke@users.noreply.github.com> Date: Thu, 25 Jan 2024 11:52:45 +0000 Subject: [PATCH 5/5] Add code snippet to GTM doc --- docs/consent/google-tag-manager.md | 37 +++++++++++++++++++++++++++++- 1 file changed, 36 insertions(+), 1 deletion(-) diff --git a/docs/consent/google-tag-manager.md b/docs/consent/google-tag-manager.md index e8a2b99..ed02ffc 100644 --- a/docs/consent/google-tag-manager.md +++ b/docs/consent/google-tag-manager.md @@ -1,6 +1,41 @@ # Google Tag Manager Consent Integration -Support for Google Tag Manager is provided via GTM's data layer variable. When either the page loads or consent is subsequently changed the data layer is updated allowing you to create triggers based on the consent given. +Support for Google Tag Manager (GTM) can be added via GTM's data layer variable. + +You will need to add the following PHP file to your application somewhere and load it. It can be a `mu-plugin`, or part of a theme for example. + +```php +