Integrating your Cookie Banner with Burst Statistics

As you might have guessed, as this plugin is developed by Really Simple Plugins, it is already fully integrated with Complianz. Because you might be using another consent management plugin, you might want to integrate with Burst as well. There are 2 things to consider;
  • Burst uses javascript. You’ll need to be able to block javascript with your consent management tool
  • Burst has an option for Cookieless tracking, but it is possible to add a cookie after consent for more detailed tracking. We will explain how Complianz does this. If you’re not comfortable integrating this with your plugin, please forward this article to your preferred plugin.

Blocking Burst’s Javascript

Burst is loaded with a single Javascript, these are the attributes:
				
					<script src=
'.../plugins/burst-statistics/assets/js/build/burst.min.js' 
id='burst-js' 
defer> 
</script>

				
			

You should be able to block burst.min.js, if you can target script by id, you could use ‘burst-js’.

When Complianz blocks burst.min.js it will change the script to below example:

				
					<script 
data-service="Burst"
data-category="Functional"
src=
'.../plugins/burst-statistics/assets/js/build/burst.min.js' 
id='burst-js' 
defer> 
</script>

				
			

Using Cookieless tracking and Consent

You can use Cookieless tracking without integration, but if you want to use cookies nonetheless to get more detailed results after consent, you will need to initialize Burst after consent. This is an example of how Complianz implemented this and you might want to show your consent plugin’s author.

				
					// Check for Burst Setting
// If Cookieless is enabled and consent. Disable Cookieless and set cookie.

function cmplz_burst_statistics_activate_burst() {
	ob_start();
	if ( burst_get_value('enable_cookieless_tracking') ) {
		// if cookieless tracking is enabled, we need to add a listener to the consent change
		// to turn off cookieless tracking and set a cookie
		?>
		<script>
			document.addEventListener("burst_before_track_hit", function(burstData) {
				if ( cmplz_has_consent('statistics') ) {
					window.burst_enable_cookieless_tracking = 0;
				}
			});
			document.addEventListener("cmplz_status_change", function (){
				if ( cmplz_has_consent('statistics') ) {
					window.burst_enable_cookieless_tracking = 0;
					let event = new CustomEvent('burst_enable_cookies');
					document.dispatchEvent( event );
				}
			});
		</script>
		<?php
	} else {
	
// Check region if Cookieless is not possible
// Run Burst after consent
		?>
		<script>
			document.addEventListener("cmplz_cookie_warning_loaded", function(consentData) {
				let region = consentData.detail;
				if ( region !== 'uk' ) {
					let scriptElements = document.querySelectorAll('script[data-service="burst"]');
					scriptElements.forEach(obj => {
						if ( obj.classList.contains('cmplz-activated') || obj.getAttribute('type') === 'text/javascript' ) {
							return;
						}
						obj.classList.add( 'cmplz-activated' );
						let src = obj.getAttribute('src');
						if ( src ) {
							obj.setAttribute('type', 'text/javascript');
							cmplz_run_script(src, 'statistics', 'src');
							obj.parentNode.removeChild(obj);
						}
					});
				}

			});
			document.addEventListener("cmplz_run_after_all_scripts", cmplz_burst_fire_domContentLoadedEvent);
			function cmplz_burst_fire_domContentLoadedEvent() {
				let event = new CustomEvent('burst_fire_hit');
				document.dispatchEvent( event );
			}
		</script>
		<?php
	}


	$script = ob_get_clean();
	$script = str_replace(array('<script>', '</script>'), '', $script);
	wp_add_inline_script( 'cmplz-cookiebanner', $script);
}
add_action( 'wp_enqueue_scripts', 'cmplz_burst_statistics_activate_burst',PHP_INT_MAX );
				
			

Adding Burst to your Cookie Policy

If you’re using Cookieless tracking only, please use this information from Cookiedatabase.org to use for your privacy policy: https://cookiedatabase.org/service/burst-statistics/

If you’re using cookies with Burst, please use this description on your cookie policy for the cookie: burst_uid

Cookieburst_uid
Functionto store and track interaction locally
Retention1 month
PurposeStatistics
DataAnonymous ID
ServiceFirst Party – Burst Statistics

Enhance your understanding of website visitors! Track country data, URL parameters, and multiple goals. Plus, enjoy premium support whenever needed!