Skip to content

Commit

Permalink
Merge pull request #14 from humanmade/backport-13-to-v6-branch
Browse files Browse the repository at this point in the history
[Backport v6-branch] Check cookie banner display option for analytics integration
  • Loading branch information
roborourke authored Feb 19, 2021
2 parents 383dafc + 8a4f7e9 commit 23a6ae4
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion inc/consent/namespace.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
namespace Altis\Privacy\Consent;

use Altis;
use Altis\Consent;

/**
* Kick it off.
Expand All @@ -23,7 +24,7 @@ function bootstrap() {
add_action( 'plugins_loaded', __NAMESPACE__ . '\\load_plugins', 1 );

// Ensure native analytics consent is enabled.
add_filter( 'altis.analytics.consent_enabled', '__return_true' );
add_filter( 'altis.analytics.consent_enabled', __NAMESPACE__ . '\\analytics_integration_enabled' );
}

/**
Expand All @@ -33,3 +34,12 @@ function load_plugins() {
require_once Altis\ROOT_DIR . '/vendor/altis/consent-api/plugin.php';
require_once Altis\ROOT_DIR . '/vendor/altis/consent/plugin.php';
}

/**
* Check if the consent banner is displayed to activate analytics integration.
*
* @return bool
*/
function analytics_integration_enabled() : bool {
return Consent\should_display_banner();
}

0 comments on commit 23a6ae4

Please sign in to comment.