Your IP : 216.73.216.219


Current Path : /home/pteabiscqq/www/plugins/system/lab5_cookie_commander/analytics/
Upload File :
Current File : /home/pteabiscqq/www/plugins/system/lab5_cookie_commander/analytics/analytics.php

<?php defined('_JEXEC') or die();
/////////////////////////////////////////////////////////////////////////////////////////////
/** 
* Cookie Commander
* 
* @author : Lab5 - Dennis Riegelsberger
* @authorUrl : https://lab5.ch
* @copyright : Copyright (C) 2018+  Lab5 - Dennis Riegelsberger. All rights reserved.
* @license : GNU/GPL General Public License version 2 or later
* @project : https://lab5.ch/cookie-commander
* @on JED : https://extensions.joomla.org/extensions/extension/site-management/cookie-control/lab5-cookie-commander/
* 
* Built with <3 
* Lab5
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ 
/**
 * @CHANGELOG :
 */
/////////////////////////////////////////////////////////////////////////////////////////////
if ( self::$this->params->get('anal_activate_google', false ) OR  self::$this->params->get('anal_activate_piwik', false ) ) : 
/////////////////////////////////////////////////////////////////////////////////////////////

	if( !isset(self::$xstor->cooco)) self::$xstor->cooco = new stdClass();

	////////////////////////////////////////////////
	// Analytics - Google 
	////////////////////////////////////////////////
	
					// if( self::$xstor->cooco->modusOperandi == 'optout' && self::$xstor->cooco->activate_google ):
					if( self::$xstor->cooco->include_google ):
	
										$content = JResponse::getBody();
										require ('code.google.donottrack.php'); 
										require ('code.google.php'); 
										$anal_code = ''.
										// '<!-- Google Analytics Code -->'."\n";
										'<script type="text/javascript">'."\n".
												$anal_code."\n".
										'</script>'."\n";
										// '<!-- End Google Analytics Code -->'."\n";
										
										if( self::$xstor->cooco->googlePosition == 2 ){
										$content = str_replace( '</body>', $anal_code.'</body>', $content);
										}else{
										$content = str_replace( '</head>', $anal_code.'</head>', $content);
										}
										JResponse::setBody($content); 
				
					endif;
					
	////////////////////////////////////////////////
	// Analytics - MATOMO / PIWIK  -  via JS  // 1 = JavaScript
	////////////////////////////////////////////////

					// self::$xstor->cooco->modusOperandi == 'optout' && 
					if( self::$xstor->cooco->include_piwik && self::$xstor->cooco->piwikEmbedMode == 1 ): // 1 = JavaScript
							
										$content = JResponse::getBody();
										require ('code.piwik.php'); 
										$anal_code = ''.
										// '<!-- Matomo -->'."\n";
										'<script type="text/javascript">'."\n".
												' var _paq = window._paq = window._paq || [];  '."\n".
												// ' var _paq = _paq || [];  '."\n".
												$anal_code."\n".
										'</script>'."\n";
										// '<!-- End Matomo Code -->'."\n";
										
										$content = str_replace( '</head>', $anal_code.'</head>', $content);
										JResponse::setBody($content); 
			
					endif;
					
	////////////////////////////////////////////////
	// Analytics - MATOMO / PIWIK  -  via PHP  // 2 = Hidden (PHP)
	////////////////////////////////////////////////
	

					if(  self::$xstor->cooco->activate_piwik && self::$xstor->cooco->piwikAUTHtoken ){ // 2 = Hidden (PHP)
							if( self::$xstor->cooco->piwikEmbedMode > 1 ){ 
										// if( !self::$xstor->cooco->donottrack  ){ 
										if( !self::$xstor->cooco->donottrack OR self::$xstor->cooco->piwikEmbedMode == 3  ){ 
														
														// self::$xstor->cooco->include_piwik = false;  
														require 'inc.piwik.php'; 
										}
							} 
					} 
 
/////////////////////////////////////////////////////////////////////////////////////////////
endif;