summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorhargobind2016-05-20 14:20:47 (GMT)
committerMaciej Zgadzaj2016-05-20 14:20:47 (GMT)
commitd2ed2682cdc8b84699b6aca088a882baabe63724 (patch)
treed76149a76481a93dc3d49bfb1699c98b8b86fdfb
parent34a043f714e159188bc00d9168b5feca0b2741b0 (diff)
Issue #2698207 by hargobind: Configuration to turn of FB pixel on admin pages
-rwxr-xr-xfacebook_pixel.admin.inc7
-rwxr-xr-xfacebook_pixel.module4
2 files changed, 11 insertions, 0 deletions
diff --git a/facebook_pixel.admin.inc b/facebook_pixel.admin.inc
index bf914f6..5c9935b 100755
--- a/facebook_pixel.admin.inc
+++ b/facebook_pixel.admin.inc
@@ -18,5 +18,12 @@ function facebook_pixel_admin_settings_form($form_state) {
'#default_value' => variable_get('facebook_pixel_id'),
);
+ $form['facebook_pixel_exclude_admin_paths'] = array(
+ '#type' => 'checkbox',
+ '#title' => t('Exclude from admin pages'),
+ '#description' => t('The pixel tracking code will not be added to admin pages.'),
+ '#default_value' => variable_get('facebook_pixel_exclude_admin_paths', 1),
+ );
+
return system_settings_form($form);
}
diff --git a/facebook_pixel.module b/facebook_pixel.module
index 0739d29..f55dff1 100755
--- a/facebook_pixel.module
+++ b/facebook_pixel.module
@@ -125,6 +125,10 @@ function facebook_pixel_add_event($event) {
* @see facebook_pixel_add_event()
*/
function facebook_pixel_preprocess_page(&$variables) {
+ if (variable_get('facebook_pixel_exclude_admin_paths', 1) && path_is_admin(current_path())) {
+ return;
+ }
+
if ($pixel_id = variable_get('facebook_pixel_id')) {
$script = "
<!-- Facebook Pixel Code -->