diff --git a/bl-plugins/google-analytics/languages/en.json b/bl-plugins/google-analytics/languages/en.json new file mode 100644 index 00000000..0851e093 --- /dev/null +++ b/bl-plugins/google-analytics/languages/en.json @@ -0,0 +1,14 @@ +{ + "plugin-data": + { + "name": "Google Analytics", + "description": "This plugin generates the necessary code for the following Google tools: Google Analytics, Google Tag Manager and Google Site Verification HTML Tag." + }, + + "google-webmasters-tools": "Google Webmasters tools", + "google-analytics-tracking-id": "Google Analytics Tracking ID", + "google-tag-manager": "Google Tag Manager", + "complete-this-field-with-the-google-site-verification": "Complete this field with the Google Site verification to verify the site owner.", + "complete-this-field-with-the-tracking-id": "Complete this field with the Tracking ID to generate the Javascript tracking code for Google Analytics.", + "complete-this-field-with-the-tracking-id-google-tag": "Complete this field with the Tracking ID to generate the Javascript tracking code for Google Tag Manager." +} \ No newline at end of file diff --git a/bl-plugins/google-analytics/metadata.json b/bl-plugins/google-analytics/metadata.json new file mode 100644 index 00000000..13635940 --- /dev/null +++ b/bl-plugins/google-analytics/metadata.json @@ -0,0 +1,10 @@ +{ + "author": "Bludit", + "email": "", + "website": "https://plugins.bludit.com", + "version": "2.3", + "releaseDate": "2018-01-23", + "license": "MIT", + "compatible": "2.3", + "notes": "" +} \ No newline at end of file diff --git a/bl-plugins/google-analytics/plugin.php b/bl-plugins/google-analytics/plugin.php new file mode 100644 index 00000000..5f51f201 --- /dev/null +++ b/bl-plugins/google-analytics/plugin.php @@ -0,0 +1,113 @@ +dbFields = array( + 'EUGDPR'=>true, + 'trackingID'=>'' + ); + } + + public function form() + { + global $Language; + + $html = '
'; + $html .= ''; + $html .= ''; + $html .= ''.$Language->get('complete-this-field-with-the-tracking-id').''; + $html .= '
'; + + $html .= '
'; + $html .= ''; + $html .= ''; + $html .= 'Show the consent to the user before loading the script of Google Analytics. The user can reject be tracked for Google Analytics.'; + $html .= '
'; + + return $html; + } + + public function siteHead() + { + $html = ''; + + return $html; + } + + public function siteBodyBegin() + { + $script = ' + + '; + + if ($this->getValue('EUGDPR')) { + $html = '
'; + $html .= '
Allow to Google Analytics tracking you?
'; + $html .= '
'; + $html .= ''; + $html .= ''; + $html .= '
'; + $html .= '
'; + } else { + $html = ''; + } + + $script .= ' + + '; + + return $script.$html; + } +}