How to disable tracking code in edit mode?
Permalink 1 user found helpful
Hi there,
I need to hide the tracking code (setting through dashboard -> Sitewide Settings) when a page is in edit mode. Because this code runs every time when i edit my page and increase the page hits rapidly.
I need to hide the tracking code (setting through dashboard -> Sitewide Settings) when a page is in edit mode. Because this code runs every time when i edit my page and increase the page hits rapidly.
Thanks for your quick reply... But I tried that and looks not working in my site...
Well that disables it for EDIT mode which means that you have clicked the EDIT button from a page after logging in.
If you want to disable the code always if you're logged in, just add this to the footer_required.php:
And again, if you get $u is not defined, just add this to the top of the file:
Antti / Mainio
If you want to disable the code always if you're logged in, just add this to the footer_required.php:
if (!$u->isLoggedIn()) { echo Config::get('SITE_TRACKING_CODE'); }
And again, if you get $u is not defined, just add this to the top of the file:
global $u;
Antti / Mainio
This use to work for me on my site (saved in elements/footer_required.php)
Now, with Concrete 5.5.1 it just removes the edit bar.
Help!?
Ollie
<?php $u = new User(); if (!$u->isRegistered()) { echo Config::get('SITE_TRACKING_CODE'); } ?>
Now, with Concrete 5.5.1 it just removes the edit bar.
Help!?
Ollie
Turns out this was the fix (added to both footer_required and header_required)
Kudos to my mate Lc for the fix!
<?php $u = new User(); $_trackingCodePosition = Config::get('SITE_TRACKING_CODE_POSITION'); if (empty($disableTrackingCode) && (empty($_trackingCodePosition) /**/ && !$u->isRegistered() || $_trackingCodePosition === 'bottom') /**/ && !$u->isRegistered() { echo Config::get('SITE_TRACKING_CODE'); } print $this->controller->outputFooterItems(); ?>
Kudos to my mate Lc for the fix!
2. Open the copied file for editing
3. There you see this:
4. Wrap it around if clause:
If it gives you $c is not defined, at the top of that file, add this:
Br,
Antti / Mainio