Hi
Ive recently been finding when working on a MODx site and testing it out my Analytics stats go off the scale due to manager users testing out the site etc so i thought it would be a good idea to be able to disable Analytics code if you was logged into the MODx Manager.
So heres the instructions
1. In your template or footer chunk add in a snippet call to [[googleAnalyticsCode]]
2. Create a chunk called
googleAnalyticsCode and paste in your google tracking code
3. Create a snippet called
googleAnalyticsCode and paste in the following
<?php
$google_AnalyticsCode = "";
if(!isset($_SESSION[’mgrValidated’])) {
// Pull in Analytics Code
$google_AnalyticsCode = $modx->putChunk(’googleAnalyticsCode’);
}
return $google_AnalyticsCode;
?>
Hope this is helpful for you all
Aaron