} wp_localize_script('ecwid-kissmetrics-events', 'ecwid_kissmetrics', $kissmetrics); } protected function _record($event) { $params = array('_k' => self::API_KEY, '_p' => $_COOKIE['km_ai'], '_n' => $event); $query = http_build_query($params); //die(var_dump($_COOKIE)); $result = wp_remote_get('http://trk.kissmetrics.com/e?' . $query); } protected function _enqueue_record($event) { $events = $this->_get_pending_events(); array_push($events, array('event' => $event)); update_option(self::STORAGE_OPTION_NAME, $events); } protected function _get_pending_events() { $value = get_option(self::STORAGE_OPTION_NAME); if (!is_array($value)) { $value = array(); } return $value; } protected function _flush_events() { update_option(self::STORAGE_OPTION_NAME, null); } } Ecwid_Kissmetrics::init();