You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
'hint' => $this->l('This information is available in your Google Analytics account')
168
168
),
169
169
array(
170
-
'type' => 'radio',
170
+
'type' => 'switch',
171
171
'label' => $this->l('Enable User ID tracking'),
172
172
'name' => 'GA_USERID_ENABLED',
173
173
'hint' => $this->l('The User ID is set at the property level. To find a property, click Admin, then select an account and a property. From the Property column, click Tracking Info then User ID'),
@@ -184,6 +184,24 @@ public function displayForm()
184
184
),
185
185
),
186
186
),
187
+
array(
188
+
'type' => 'switch',
189
+
'label' => $this->l('Anonymize IP'),
190
+
'name' => 'GA_ANONYMIZE_ENABLED',
191
+
'hint' => $this->l('Use this option to anonymize the visitor’s IP to comply with data privacy laws in some countries'),
@@ -637,6 +660,38 @@ protected function _runJs($js_code, $backoffice = 0)
637
660
}
638
661
}
639
662
663
+
/**
664
+
* Manage data
665
+
* @param string $action "R" read data from DB, "W" write data, "A" append data, D" delete data
666
+
* @return array dans le cas du R, sinon true
667
+
*/
668
+
protectedfunction_manageData($data, $action)
669
+
{
670
+
if ($action == 'R') {
671
+
$dataretour = Db::getInstance()->getValue('SELECT data FROM `'._DB_PREFIX_.'ganalytics_data` WHERE id_cart = \''.(int)$this->context->cart->id.'\' AND id_shop = \''.(int)$this->context->shop->id.'\'');
672
+
if ($dataretour === false)
673
+
returnarray();
674
+
else
675
+
returnjson_decode($dataretour,true);
676
+
}
677
+
if ($action == 'W') {
678
+
return Db::getInstance()->Execute('INSERT INTO `'._DB_PREFIX_.'ganalytics_data` (id_cart, id_shop, data) VALUES(\''.(int)$this->context->cart->id.'\',\''.(int)$this->context->shop->id.'\',\''.json_encode($data).'\') ON DUPLICATE KEY UPDATE data =\''.json_encode($data).'\' ;');
679
+
}
680
+
if ($action == 'A') {
681
+
$dataretour = Db::getInstance()->getValue('SELECT data FROM `'._DB_PREFIX_.'ganalytics_data` WHERE id_cart = \''.(int)$this->context->cart->id.'\' AND id_shop = \''.(int)$this->context->shop->id.'\'');
682
+
if ($dataretour === false)
683
+
$datanew = array($data);
684
+
else {
685
+
$datanew = json_decode($dataretour,true);
686
+
$datanew[] = $data;
687
+
}
688
+
return Db::getInstance()->Execute('INSERT INTO `'._DB_PREFIX_.'ganalytics_data` (id_cart, id_shop, data) VALUES(\''.(int)$this->context->cart->id.'\',\''.(int)$this->context->shop->id.'\',\''.json_encode($datanew).'\') ON DUPLICATE KEY UPDATE data =\''.serialize($datanew).'\' ;');
689
+
}
690
+
if ($action == 'D') {
691
+
Db::getInstance()->execute('DELETE FROM `'._DB_PREFIX_.'ganalytics_data` WHERE id_cart = \''.(int)$this->context->cart->id.'\' AND id_shop = \''.(int)$this->context->shop->id.'\'');
692
+
}
693
+
}
694
+
640
695
/**
641
696
* Hook admin order to send transactions and refunds details
642
697
*/
@@ -774,11 +829,7 @@ public function hookactionCartSave()
0 commit comments