This commit introduces a comprehensive cookie consent management system by integrating the `fxCookiesAllowMarketing()` function across multiple files. It ensures that marketing-related scripts, such as Facebook Pixel and Google Analytics, are only executed if the user has consented to cookies. Additionally, it enhances the cookie consent UI in `inc_footer.php` and `inc_header.php`, improving user experience and compliance with privacy regulations. The changes also include refactoring of cookie handling functions for better maintainability.
77 lines
2.5 KiB
PHP
77 lines
2.5 KiB
PHP
<?php
|
|
/**
|
|
* Created by PhpStorm.
|
|
* User: Utilisateur
|
|
* Date: 2018-04-24
|
|
* Time: 13:30
|
|
*/
|
|
//**
|
|
// Usager: stephan
|
|
// Date : 24-04-18
|
|
// jira : MSIN-2310
|
|
// Time : 09:02
|
|
//
|
|
// pixcel facebook
|
|
|
|
if (!fxCookiesAllowMarketing()) {
|
|
return;
|
|
}
|
|
|
|
// Facebook Pixel Code
|
|
$mem_facebook_pixel=0;
|
|
//echo $tabEvenement['general']['eve_facebook_pixel'];
|
|
//if (isset($_SESSION['pixcel']))
|
|
//print_r($_SESSION['pixcel']);
|
|
if (isset($tabEvenement['general']['eve_facebook_pixel'])) {
|
|
if ($tabEvenement['general']['eve_facebook_pixel'] <> '') {
|
|
$mem_facebook_pixel = 1;
|
|
?>
|
|
<meta name="facebook-domain-verification" content="<?php echo $tabEvenement['general']['eve_facebook_meta']?>" />
|
|
<script>
|
|
!function(f,b,e,v,n,t,s)
|
|
{if(f.fbq)return;n=f.fbq=function(){n.callMethod?
|
|
|
|
n.callMethod.apply(n,arguments):n.queue.push(arguments)};
|
|
if(!f._fbq)f._fbq=n;
|
|
n.push=n;n.loaded=!0;n.version='2.0';
|
|
n.queue=[];t=b.createElement(e);t.async=!0;
|
|
|
|
t.src=v;s=b.getElementsByTagName(e)[0];
|
|
s.parentNode.insertBefore(t,s)}(window,
|
|
document,'script',
|
|
'https://connect.facebook.net/en_US/fbevents.js');
|
|
|
|
fbq('init', '<?php echo $tabEvenement['general']['eve_facebook_pixel']; ?>');
|
|
fbq('track', 'PageView');
|
|
|
|
function fbq_pw($param1,$param2,$param3) {
|
|
<?php
|
|
if ($mem_facebook_pixel == 1) {
|
|
?>
|
|
fbq($param1,$param2,$param3);
|
|
<?php
|
|
}
|
|
?>
|
|
}
|
|
</script>
|
|
<?php
|
|
if (isset($_SESSION['pixcel'])){
|
|
foreach ($_SESSION['pixcel'] as $key => $value) {
|
|
echo('<br>');
|
|
?>
|
|
<script>
|
|
fbq('<?php echo $value['param1']; ?>','<?php echo $value['param2']; ?>',{content_name:'<?php echo urlencode($value['content_name']); ?>',content_type:'product',value:<?php echo $value['value']; ?>,content_ids:'<?php echo $value['content_ids']; ?>',currency:'<?php echo $value['currency']; ?>'});
|
|
</script>
|
|
<?php
|
|
}
|
|
}
|
|
?>
|
|
<noscript>
|
|
<img height="1" width="1" style="display:none" src="https://www.facebook.com/tr?id=<?php echo $tabEvenement['general']['eve_facebook_pixel']; ?>&ev=PageView&noscript=1"/>
|
|
</noscript>
|
|
<?php
|
|
}
|
|
}
|
|
|
|
if (isset($_SESSION['pixcel']))
|
|
unset($_SESSION['pixcel']);
|