53 static::EVENT_ADD_PAYMENT,
54 static::EVENT_ADD_TO_CART,
55 static::EVENT_ADD_TO_WISH_LIST,
56 static::EVENT_COMPLETE_REGISTRATION,
57 static::EVENT_CONTACT,
59 static::EVENT_FIND_LOCATION,
60 static::EVENT_INITIATE_CHECKOUT,
62 static::EVENT_PAGE_VIEW,
64 static::EVENT_START_TRIAL,
65 static::EVENT_SUBMIT_APPLICATION,
66 static::EVENT_SUBSCRIBE,
67 static::EVENT_VIEW_CONTENT,
68 static::EVENT_PURCHASE
78 static::ACTION_SOURCE_EMAIL,
79 static::ACTION_SOURCE_WEBSITE,
80 static::ACTION_SOURCE_APP,
81 static::ACTION_SOURCE_PHONE_CALL,
82 static::ACTION_SOURCE_CHAT,
83 static::ACTION_SOURCE_PHYSICAL_STORE,
84 static::ACTION_SOURCE_SYSTEM_GENERATED,
85 static::ACTION_SOURCE_OTHER
96 if ($params && !empty($params))
98 if (array_key_exists(
'action_source',$params) && is_string($params[
'action_source']))
102 if (array_key_exists(
'event_time',$params) && is_int($params[
'event_time']))
104 $this->
setTime($params[
'event_time']);
106 if (array_key_exists(
'opt_out',$params) && is_bool($params[
'opt_out']))
110 if (array_key_exists(
'event_name',$params) && is_string($params[
'event_name']))
114 if (array_key_exists(
'event_source_url',$params) && is_string($params[
'event_source_url']))
116 $this->
setSource($params[
'event_source_url']);
118 if (array_key_exists(
'user_data',$params))
120 if ($params[
'user_data'] instanceof
UserData)
124 } elseif (is_array($params[
'user_data']))
126 $this->
setUserData(
new UserData($params[
'user_data']));
129 if (array_key_exists(
'custom_data',$params))
131 if ($params[
'custom_data'] instanceof
CustomData)
135 } elseif (is_array($params[
'custom_data']))
137 $this->
setCustomData(
new CustomData($params[
'custom_data']));
142 if (!$this->getParameter(
'event_time'))
144 $this->setParameter(
'event_time',time());
250 [$userData, $customData] = [$this->getParameter(
'user_data'), $this->getParameter(
'custom_data')];
252 $this->getParameter(
'event_name')
257 && $this->getParameter(
'event_time')
258 && $this->getParameter(
'event_time') + 604800 > time()
262 if ($this->getParameter(
'event_name') === static::EVENT_PURCHASE)
264 $result = $result && is_set($customData->getValue()) && is_set($customData->getCurrency());
266 if ($this->getParameter(
'action_source') === static::ACTION_SOURCE_WEBSITE)
268 $result = is_set($this->getParameter(
'event_source_url'));