getConfig()->log->eventLiveReportLevel !== 'none') { $data = array_merge_recursive(bb::$database->escape($_GET_AND_POST, true), [ 'customer' => [ 'customerId' => Boutique::getHandle()->client->id_client, 'lastName' => Boutique::getHandle()->client->nom, 'fistName' => Boutique::getHandle()->client->prenom, 'email' => Boutique::getHandle()->client->email, 'phone1' => Boutique::getHandle()->client->tel, 'phone2' => Boutique::getHandle()->client->tel2 ], 'source' => [ 'universe' => $_SESSION["univers_title"] ], 'infos' => [ 'userAgentServerSide' => $_SERVER["HTTP_USER_AGENT"], 'ip' => $_SERVER['REMOTE_ADDR'], 'sessId' => session_id() ] ]); if (((string) bb::$conf->getConfig()->log->eventLiveReportLevel !== 'error' || $data['logType'] === 'error') && !preg_match('/(bingbot|googlebot|adsbot)/i', $data['infos']['userAgent'].' '.$data['infos']['userAgentServerSide']) ) { // Rename ecomm fields if (is_array($data['content'])) { foreach ($data['content'] as $k => $v) { if (strpos($k, 'ecomm_') !== false) { $data['content'][substr($k, 6)] = $v; unset($data['content'][$k]); } } } if (isset($data['source']['href'])) { $href = $data['source']['href']; if (preg_match('/,moncompte,/', $href)) { $data['source']['module'] = 'account'; } elseif (preg_match('/\/recherche/', $href)) { $data['source']['module'] = 'search'; } elseif (preg_match('/,panier,/', $href)) { $data['source']['module'] = 'cart'; } elseif (preg_match('/,paiement,/', $href)) { $data['source']['module'] = 'payment'; } elseif (preg_match('/,contenu,/', $href)) { $data['source']['module'] = 'content'; } elseif (isset($data['content']['pagetype'])) { $data['source']['module'] = $data['content']['pagetype']; } } if (isset($data['date'])) { $data['date'] = new MongoDB\BSON\UTCDateTime(strtotime($data['date']) * 1000); } else { $data['date'] = new MongoDB\BSON\UTCDateTime(time() * 1000); } if (array_walk_recursive($data, function (&$value, $key) { $value = is_string($value) ? utf8_encode($value) : $value; })) { $mongoClient = new MongoDB\Client("mongodb://" . bb::$conf->getConfig()->mongoDb->uri . "/"); $database = $mongoClient->{(string) bb::$conf->getConfig()->mongoDb->database}; $customersLogs = $database->customersLogs; $customersLogs->insertOne($data); } else { throw new Exception("Unable to encode to utf8"); } } } } catch (Exception $e) { error_log($e); }