Skip to content

Commit

Permalink
fix metronet
Browse files Browse the repository at this point in the history
  • Loading branch information
szepeviktor committed Aug 28, 2024
1 parent 478319d commit 4bac23d
Showing 1 changed file with 24 additions and 2 deletions.
26 changes: 24 additions & 2 deletions mu-plugins/metronet-tag-manager.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,34 @@
*/

add_filter('option_metronet_tag_manager', static function ($value) {
if (is_admin()) {
return $value;
}

$defaults = [
'code' => '',
'code_head' => '',
'variables' => [
0 => ['name' => 'title', 'value' => '%post_title%'],
1 => ['name' => 'author', 'value' => '%author_name%'],
2 => ['name' => 'wordcount', 'value' => '%wordcount%'],
3 => ['name' => 'logged_in', 'value' => '%logged_in%'],
4 => ['name' => 'page_id', 'value' => '%page_id%'],
5 => ['name' => 'post_date', 'value' => '%post_date%'],
6 => ['name' => 'post_type', 'value' => '%post_type%'],
],
'external_variables' => [],
'is_post_enabled' => 'on',
'enable_tiny_mce' => 'on',
'enable_gutenberg' => 'on',
];

// Read CookieYes cookie
if (!isset($_COOKIE['cookieyes-consent'])) {
return false;
return $defaults;
}

return in_array('analytics:yes', explode(',', $_COOKIE['cookieyes-consent']), true)
? $value
: false;
: $defaults;
}, 20, 1);

0 comments on commit 4bac23d

Please sign in to comment.