1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Acquia\LiftClient\Entity; |
4
|
|
|
|
5
|
|
|
use Acquia\LiftClient\Exception\LiftSdkException; |
6
|
|
|
use Acquia\LiftClient\Utility\Utility; |
7
|
|
|
use DateTime; |
8
|
|
|
|
9
|
|
|
class Capture extends Entity |
10
|
|
|
{ |
11
|
|
|
const PERSON_UDF_COUNT = 50; |
12
|
|
|
const EVENT_UDF_COUNT = 50; |
13
|
|
|
const TOUCH_UDF_COUNT = 20; |
14
|
|
|
|
15
|
|
|
const UUID_PATTERN = '/^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-4[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}$/i'; |
16
|
|
|
|
17
|
|
|
/** |
18
|
|
|
* Set the 'person_udf#' field. |
19
|
|
|
* |
20
|
|
|
* @param int $num Which field to fetch. Can be from 1 till 50 |
21
|
|
|
* @param string $value Custom fields for the Acquia Lift Person Capture Phase |
22
|
|
|
* |
23
|
|
|
* @throws \Acquia\LiftClient\Exception\LiftSdkException |
24
|
|
|
* |
25
|
|
|
* @return \Acquia\LiftClient\Entity\Capture |
26
|
|
|
*/ |
27
|
24 |
View Code Duplication |
public function setPersonUdf($num, $value) |
28
|
|
|
{ |
29
|
24 |
|
if (!is_int($num)) { |
30
|
3 |
|
throw new LiftSdkException('Argument $num must be an instance of integer.'); |
31
|
|
|
} |
32
|
21 |
|
if ($num < 1 || $num > self::PERSON_UDF_COUNT) { |
33
|
3 |
|
throw new LiftSdkException('Argument $num must be greater than 0 and smaller or equal to 50.'); |
34
|
|
|
} |
35
|
18 |
|
if (!is_string($value)) { |
36
|
3 |
|
throw new LiftSdkException('Argument $value must be an instance of string.'); |
37
|
|
|
} |
38
|
15 |
|
$this['person_udf'.$num] = $value; |
39
|
|
|
|
40
|
15 |
|
return $this; |
41
|
|
|
} |
42
|
|
|
|
43
|
|
|
/** |
44
|
|
|
* Set the 'event_udf#' field. |
45
|
|
|
* |
46
|
|
|
* @param int $num Which field to fetch. Can be from 1 till 50 |
47
|
|
|
* @param string $value Custom fields for the Acquia Lift Event Capture Phase |
48
|
|
|
* |
49
|
|
|
* @throws \Acquia\LiftClient\Exception\LiftSdkException |
50
|
|
|
* |
51
|
|
|
* @return \Acquia\LiftClient\Entity\Capture |
52
|
|
|
*/ |
53
|
27 |
View Code Duplication |
public function setEventUdf($num, $value) |
54
|
|
|
{ |
55
|
27 |
|
if (!is_int($num)) { |
56
|
3 |
|
throw new LiftSdkException('Argument $num must be an instance of integer.'); |
57
|
|
|
} |
58
|
24 |
|
if ($num < 1 || $num > self::EVENT_UDF_COUNT) { |
59
|
3 |
|
throw new LiftSdkException('Argument $num must be greater than 0 and smaller or equal to 50.'); |
60
|
|
|
} |
61
|
21 |
|
if (!is_string($value)) { |
62
|
3 |
|
throw new LiftSdkException('Argument $value must be an instance of string.'); |
63
|
|
|
} |
64
|
18 |
|
$this['event_udf'.$num] = $value; |
65
|
|
|
|
66
|
18 |
|
return $this; |
67
|
|
|
} |
68
|
|
|
|
69
|
|
|
/** |
70
|
|
|
* Set the 'touch_udf#' field. |
71
|
|
|
* |
72
|
|
|
* @param int $num Which field to fetch. Can be from 1 till 20 |
73
|
|
|
* @param string $value Custom fields for the Acquia Lift Touch Capture Phase |
74
|
|
|
* |
75
|
|
|
* @throws \Acquia\LiftClient\Exception\LiftSdkException |
76
|
|
|
* |
77
|
|
|
* @return \Acquia\LiftClient\Entity\Capture |
78
|
|
|
*/ |
79
|
21 |
View Code Duplication |
public function setTouchUdf($num, $value) |
80
|
|
|
{ |
81
|
21 |
|
if (!is_int($num)) { |
82
|
3 |
|
throw new LiftSdkException('Argument $num must be an instance of integer.'); |
83
|
|
|
} |
84
|
18 |
|
if ($num < 1 || $num > self::TOUCH_UDF_COUNT) { |
85
|
3 |
|
throw new LiftSdkException('Argument $num must be greater than 0 and smaller or equal to 20.'); |
86
|
|
|
} |
87
|
15 |
|
if (!is_string($value)) { |
88
|
3 |
|
throw new LiftSdkException('Argument $value must be an instance of string.'); |
89
|
|
|
} |
90
|
12 |
|
$this['event_udf'.$num] = $value; |
91
|
|
|
|
92
|
12 |
|
return $this; |
93
|
|
|
} |
94
|
|
|
|
95
|
|
|
/** |
96
|
|
|
* Sets the 'event_name' parameter. |
97
|
|
|
* |
98
|
|
|
* @param string $eventName Event name corresponding to the captured information - the event type matching this |
99
|
|
|
* event name must match the master list of events created in Acquia Lift Web |
100
|
|
|
* |
101
|
|
|
* @throws \Acquia\LiftClient\Exception\LiftSdkException |
102
|
|
|
* |
103
|
|
|
* @return \Acquia\LiftClient\Entity\Capture |
104
|
|
|
*/ |
105
|
18 |
|
public function setEventName($eventName) |
106
|
|
|
{ |
107
|
18 |
|
if (!is_string($eventName)) { |
108
|
3 |
|
throw new LiftSdkException('Argument must be an instance of string.'); |
109
|
|
|
} |
110
|
15 |
|
$this['event_name'] = $eventName; |
111
|
|
|
|
112
|
15 |
|
return $this; |
113
|
|
|
} |
114
|
|
|
|
115
|
|
|
/** |
116
|
|
|
* Sets the 'event_source' parameter. |
117
|
|
|
* |
118
|
|
|
* @param string $eventSource Source of the event - can be used to pass event data from tools you have set up to |
119
|
|
|
* send data to Acquia Lift Web (the default Acquia Lift Web value is web; depending on |
120
|
|
|
* your website's configuration, examples may include csrtool1 and promo1) |
121
|
|
|
* |
122
|
|
|
* @throws \Acquia\LiftClient\Exception\LiftSdkException |
123
|
|
|
* |
124
|
|
|
* @return \Acquia\LiftClient\Entity\Capture |
125
|
|
|
*/ |
126
|
18 |
|
public function setEventSource($eventSource) |
127
|
|
|
{ |
128
|
18 |
|
if (!is_string($eventSource)) { |
129
|
3 |
|
throw new LiftSdkException('Argument must be an instance of string.'); |
130
|
|
|
} |
131
|
15 |
|
$this['event_source'] = $eventSource; |
132
|
|
|
|
133
|
15 |
|
return $this; |
134
|
|
|
} |
135
|
|
|
|
136
|
|
|
/** |
137
|
|
|
* Sets the 'event_date' parameter. |
138
|
|
|
* |
139
|
|
|
* @param DateTime $eventDate |
140
|
|
|
* |
141
|
|
|
* @throws \Acquia\LiftClient\Exception\LiftSdkException |
142
|
|
|
* |
143
|
|
|
* @return \Acquia\LiftClient\Entity\Capture |
144
|
|
|
*/ |
145
|
15 |
View Code Duplication |
public function setEventDate(DateTime $eventDate) |
146
|
|
|
{ |
147
|
|
|
// Lift Profile Manager is currently accepting this ISO 8601 format: |
148
|
|
|
// "2017-02-07T19:59:53.123Z" (or "2017-02-07T19:59:53.000Z" pre 7.0 ). |
149
|
15 |
|
// todo: the above comment needs updating |
150
|
|
|
// todo: works for all but hhvm-3.18.5 |
151
|
15 |
|
$format = 'Y-m-d\TH:i:s.v\Z'; |
152
|
|
|
if (version_compare(phpversion(), '7.0', '<')) { |
153
|
|
|
$format = 'Y-m-d\TH:i:s.000\Z'; |
154
|
|
|
} |
155
|
|
|
$this['event_date'] = $eventDate->format($format); |
156
|
|
|
|
157
|
|
|
return $this; |
158
|
|
|
} |
159
|
|
|
|
160
|
|
|
/** |
161
|
|
|
* Sets the 'identities' parameter. |
162
|
|
|
* |
163
|
|
|
* @param array $identities Additional identity information |
164
|
|
|
* |
165
|
|
|
* Example of how to structure the $identities parameter: |
166
|
|
|
* <code> |
167
|
|
|
* $options = [ |
168
|
|
|
* '[email protected]' => 'email', |
169
|
|
|
* 'John Smith' => 'name', |
170
|
|
|
* ]; |
171
|
18 |
|
* </code> |
172
|
|
|
* |
173
|
18 |
|
* @throws \Acquia\LiftClient\Exception\LiftSdkException |
174
|
3 |
|
* |
175
|
|
|
* @return \Acquia\LiftClient\Entity\Capture |
176
|
15 |
|
*/ |
177
|
|
|
public function setIdentities(array $identities) |
178
|
15 |
|
{ |
179
|
|
|
if (Utility::arrayDepth($identities) > 1) { |
180
|
|
|
throw new LiftSdkException('Identities argument is more than 1 level deep.'); |
181
|
|
|
} |
182
|
|
|
$this['identities'] = $identities; |
183
|
|
|
|
184
|
|
|
return $this; |
185
|
|
|
} |
186
|
|
|
|
187
|
|
|
/** |
188
|
|
|
* Sets the 'url' parameter. |
189
|
|
|
* |
190
|
18 |
|
* @param string $url Event's URL |
191
|
|
|
* |
192
|
18 |
|
* @throws \Acquia\LiftClient\Exception\LiftSdkException |
193
|
3 |
|
* |
194
|
|
|
* @return \Acquia\LiftClient\Entity\Capture |
195
|
15 |
|
*/ |
196
|
|
|
public function setUrl($url) |
197
|
15 |
|
{ |
198
|
|
|
if (!is_string($url)) { |
199
|
|
|
throw new LiftSdkException('Argument must be an instance of string.'); |
200
|
|
|
} |
201
|
|
|
$this['url'] = $url; |
202
|
|
|
|
203
|
|
|
return $this; |
204
|
|
|
} |
205
|
|
|
|
206
|
|
|
/** |
207
|
|
|
* Sets the 'referral_url' parameter. |
208
|
|
|
* |
209
|
18 |
|
* @param string $referralUrl Referrer's URL |
210
|
|
|
* |
211
|
18 |
|
* @throws \Acquia\LiftClient\Exception\LiftSdkException |
212
|
3 |
|
* |
213
|
|
|
* @return \Acquia\LiftClient\Entity\Capture |
214
|
15 |
|
*/ |
215
|
|
|
public function setReferralUrl($referralUrl) |
216
|
15 |
|
{ |
217
|
|
|
if (!is_string($referralUrl)) { |
218
|
|
|
throw new LiftSdkException('Argument must be an instance of string.'); |
219
|
|
|
} |
220
|
|
|
$this['referral_url'] = $referralUrl; |
221
|
|
|
|
222
|
|
|
return $this; |
223
|
|
|
} |
224
|
|
|
|
225
|
|
|
/** |
226
|
|
|
* Sets the 'content_title' parameter. |
227
|
|
|
* |
228
|
18 |
|
* @param string $contentTitle Page title |
229
|
|
|
* |
230
|
18 |
|
* @throws \Acquia\LiftClient\Exception\LiftSdkException |
231
|
3 |
|
* |
232
|
|
|
* @return \Acquia\LiftClient\Entity\Capture |
233
|
15 |
|
*/ |
234
|
|
|
public function setContentTitle($contentTitle) |
235
|
15 |
|
{ |
236
|
|
|
if (!is_string($contentTitle)) { |
237
|
|
|
throw new LiftSdkException('Argument must be an instance of string.'); |
238
|
|
|
} |
239
|
|
|
$this['content_title'] = $contentTitle; |
240
|
|
|
|
241
|
|
|
return $this; |
242
|
|
|
} |
243
|
|
|
|
244
|
|
|
/** |
245
|
|
|
* Sets the 'user_agent' parameter. |
246
|
|
|
* |
247
|
18 |
|
* @param string $userAgent Visitor's user agent |
248
|
|
|
* |
249
|
18 |
|
* @throws \Acquia\LiftClient\Exception\LiftSdkException |
250
|
3 |
|
* |
251
|
|
|
* @return \Acquia\LiftClient\Entity\Capture |
252
|
15 |
|
*/ |
253
|
|
|
public function setUserAgent($userAgent) |
254
|
15 |
|
{ |
255
|
|
|
if (!is_string($userAgent)) { |
256
|
|
|
throw new LiftSdkException('Argument must be an instance of string.'); |
257
|
|
|
} |
258
|
|
|
$this['user_agent'] = $userAgent; |
259
|
|
|
|
260
|
|
|
return $this; |
261
|
|
|
} |
262
|
|
|
|
263
|
|
|
/** |
264
|
|
|
* Sets the 'platform' parameter. |
265
|
|
|
* |
266
|
18 |
|
* @param string $platform Visitor's platform |
267
|
|
|
* |
268
|
18 |
|
* @throws \Acquia\LiftClient\Exception\LiftSdkException |
269
|
3 |
|
* |
270
|
|
|
* @return \Acquia\LiftClient\Entity\Capture |
271
|
15 |
|
*/ |
272
|
|
|
public function setPlatform($platform) |
273
|
15 |
|
{ |
274
|
|
|
if (!is_string($platform)) { |
275
|
|
|
throw new LiftSdkException('Argument must be an instance of string.'); |
276
|
|
|
} |
277
|
|
|
$this['platform'] = $platform; |
278
|
|
|
|
279
|
|
|
return $this; |
280
|
|
|
} |
281
|
|
|
|
282
|
|
|
/** |
283
|
|
|
* Sets the 'ip_address' parameter. |
284
|
|
|
* |
285
|
21 |
|
* @param string $ipAddress Visitor's IP address (supports both IPv4 and IPv6 addresses) |
286
|
|
|
* |
287
|
21 |
|
* @throws \Acquia\LiftClient\Exception\LiftSdkException |
288
|
3 |
|
* |
289
|
|
|
* @return \Acquia\LiftClient\Entity\Capture |
290
|
18 |
|
*/ |
291
|
|
|
public function setIpAddress($ipAddress) |
292
|
18 |
|
{ |
293
|
|
|
if (!is_string($ipAddress)) { |
294
|
|
|
throw new LiftSdkException('Argument must be an instance of string.'); |
295
|
|
|
} |
296
|
|
|
$this['ip_address'] = $ipAddress; |
297
|
|
|
|
298
|
|
|
return $this; |
299
|
|
|
} |
300
|
|
|
|
301
|
|
|
/** |
302
|
|
|
* Sets the 'persona' parameter. |
303
|
|
|
* |
304
|
|
|
* @param string $persona User-defined category into which a visitor fits, based on their viewing of particular |
305
|
18 |
|
* content |
306
|
|
|
* |
307
|
18 |
|
* @throws \Acquia\LiftClient\Exception\LiftSdkException |
308
|
3 |
|
* |
309
|
|
|
* @return \Acquia\LiftClient\Entity\Capture |
310
|
15 |
|
*/ |
311
|
|
|
public function setPersona($persona) |
312
|
15 |
|
{ |
313
|
|
|
if (!is_string($persona)) { |
314
|
|
|
throw new LiftSdkException('Argument must be an instance of string.'); |
315
|
|
|
} |
316
|
|
|
$this['persona'] = $persona; |
317
|
|
|
|
318
|
|
|
return $this; |
319
|
|
|
} |
320
|
|
|
|
321
|
|
|
/** |
322
|
|
|
* Sets the 'engagement_score' parameter. |
323
|
|
|
* |
324
|
|
|
* @param int $engagementScore The number that you have chosen to signify the importance of a visitor's interest in |
325
|
18 |
|
* an event |
326
|
|
|
* |
327
|
18 |
|
* @throws \Acquia\LiftClient\Exception\LiftSdkException |
328
|
3 |
|
* |
329
|
|
|
* @return \Acquia\LiftClient\Entity\Capture |
330
|
15 |
|
*/ |
331
|
|
|
public function setEngagementScore($engagementScore) |
332
|
15 |
|
{ |
333
|
|
|
if (!is_integer($engagementScore)) { |
334
|
|
|
throw new LiftSdkException('Argument must be an instance of integer.'); |
335
|
|
|
} |
336
|
|
|
$this['engagement_score'] = $engagementScore; |
337
|
|
|
|
338
|
|
|
return $this; |
339
|
|
|
} |
340
|
|
|
|
341
|
|
|
/** |
342
|
|
|
* Sets the 'personalization_name' parameter. |
343
|
|
|
* |
344
|
|
|
* @param string $personalizationName Name of personalization associated with an event |
345
|
|
|
* |
346
|
|
|
* @deprecated Only used in Lift 2. For Lift 3, please use fields with prefix decision |
347
|
|
|
* |
348
|
|
|
* @throws \Acquia\LiftClient\Exception\LiftSdkException |
349
|
|
|
* |
350
|
|
|
* @return \Acquia\LiftClient\Entity\Capture |
351
|
|
|
*/ |
352
|
|
|
public function setPersonalizationName($personalizationName) |
353
|
|
|
{ |
354
|
|
|
if (!is_string($personalizationName)) { |
355
|
|
|
throw new LiftSdkException('Argument must be an instance of string.'); |
356
|
|
|
} |
357
|
|
|
$this['personalization_name'] = $personalizationName; |
358
|
|
|
|
359
|
|
|
return $this; |
360
|
|
|
} |
361
|
|
|
|
362
|
|
|
/** |
363
|
|
|
* Sets the 'personalization_machine_name' parameter. |
364
|
|
|
* |
365
|
|
|
* @param string $personalizationMachineName Machine name of personalization associated with an event |
366
|
|
|
* |
367
|
|
|
* @deprecated Only used in Lift 2. For Lift 3, please use fields with prefix decision |
368
|
|
|
* |
369
|
|
|
* @throws \Acquia\LiftClient\Exception\LiftSdkException |
370
|
|
|
* |
371
|
|
|
* @return \Acquia\LiftClient\Entity\Capture |
372
|
|
|
*/ |
373
|
|
|
public function setPersonalizationMachineName($personalizationMachineName) |
374
|
|
|
{ |
375
|
|
|
if (!is_string($personalizationMachineName)) { |
376
|
|
|
throw new LiftSdkException('Argument must be an instance of string.'); |
377
|
|
|
} |
378
|
|
|
$this['personalization_machine_name'] = $personalizationMachineName; |
379
|
|
|
|
380
|
|
|
return $this; |
381
|
|
|
} |
382
|
|
|
|
383
|
|
|
/** |
384
|
|
|
* Sets the 'personalization_chosen_variation' parameter. |
385
|
|
|
* |
386
|
|
|
* @param string $personalizationChosenVariation The variation (decision) chosen for an event |
387
|
|
|
* |
388
|
|
|
* @deprecated Only used in Lift 2. For Lift 3, please use fields with prefix decision |
389
|
|
|
* |
390
|
|
|
* @throws \Acquia\LiftClient\Exception\LiftSdkException |
391
|
|
|
* |
392
|
|
|
* @return \Acquia\LiftClient\Entity\Capture |
393
|
|
|
*/ |
394
|
|
|
public function setPersonalizationChosenVariation($personalizationChosenVariation) |
395
|
|
|
{ |
396
|
|
|
if (!is_string($personalizationChosenVariation)) { |
397
|
|
|
throw new LiftSdkException('Argument must be an instance of string.'); |
398
|
|
|
} |
399
|
|
|
$this['personalization_chosen_variation'] = $personalizationChosenVariation; |
400
|
|
|
|
401
|
|
|
return $this; |
402
|
|
|
} |
403
|
|
|
|
404
|
|
|
/** |
405
|
|
|
* Sets the 'personalization_audience_name' parameter. |
406
|
|
|
* |
407
|
|
|
* @param string $personalizationAudienceName The name of the audience |
408
|
|
|
* |
409
|
|
|
* @deprecated Only used in Lift 2. For Lift 3, please use fields with prefix decision |
410
|
|
|
* |
411
|
|
|
* @throws \Acquia\LiftClient\Exception\LiftSdkException |
412
|
|
|
* |
413
|
|
|
* @return \Acquia\LiftClient\Entity\Capture |
414
|
|
|
*/ |
415
|
|
|
public function setPersonalizationAudienceName($personalizationAudienceName) |
416
|
|
|
{ |
417
|
|
|
if (!is_string($personalizationAudienceName)) { |
418
|
|
|
throw new LiftSdkException('Argument must be an instance of string.'); |
419
|
|
|
} |
420
|
|
|
$this['personalization_audience_name'] = $personalizationAudienceName; |
421
|
|
|
|
422
|
|
|
return $this; |
423
|
|
|
} |
424
|
|
|
|
425
|
|
|
/** |
426
|
|
|
* Sets the 'personalization_decision_policy' parameter. |
427
|
|
|
* |
428
|
|
|
* @param string $personalizationDecisionPolicy The decision policy used - for example, explore or target |
429
|
|
|
* |
430
|
|
|
* @deprecated Only used in Lift 2. For Lift 3, please use fields with prefix decision |
431
|
|
|
* |
432
|
|
|
* @throws \Acquia\LiftClient\Exception\LiftSdkException |
433
|
|
|
* |
434
|
|
|
* @return \Acquia\LiftClient\Entity\Capture |
435
|
|
|
*/ |
436
|
|
|
public function setPersonalizationDecisionPolicy($personalizationDecisionPolicy) |
437
|
|
|
{ |
438
|
|
|
if (!is_string($personalizationDecisionPolicy)) { |
439
|
|
|
throw new LiftSdkException('Argument must be an instance of string.'); |
440
|
|
|
} |
441
|
|
|
$this['personalization_decision_policy'] = $personalizationDecisionPolicy; |
442
|
|
|
|
443
|
|
|
return $this; |
444
|
|
|
} |
445
|
|
|
|
446
|
|
|
/** |
447
|
|
|
* Sets the 'personalization_goal_name' parameter. |
448
|
|
|
* |
449
|
|
|
* @param string $personalizationGoalName The name of the goal reached |
450
|
|
|
* |
451
|
|
|
* @deprecated Only used in Lift 2. For Lift 3, please use fields with prefix decision |
452
|
|
|
* |
453
|
|
|
* @throws \Acquia\LiftClient\Exception\LiftSdkException |
454
|
|
|
* |
455
|
|
|
* @return \Acquia\LiftClient\Entity\Capture |
456
|
|
|
*/ |
457
|
|
|
public function setPersonalizationGoalName($personalizationGoalName) |
458
|
|
|
{ |
459
|
|
|
if (!is_string($personalizationGoalName)) { |
460
|
|
|
throw new LiftSdkException('Argument must be an instance of string.'); |
461
|
|
|
} |
462
|
|
|
$this['personalization_goal_name'] = $personalizationGoalName; |
463
|
|
|
|
464
|
|
|
return $this; |
465
|
|
|
} |
466
|
|
|
|
467
|
|
|
/** |
468
|
|
|
* Sets the 'personalization_goal_value' parameter. |
469
|
|
|
* |
470
|
|
|
* @param string $personalizationGoalValue The value of the goal reached |
471
|
|
|
* |
472
|
|
|
* @deprecated Only used in Lift 2. For Lift 3, please use fields with prefix decision |
473
|
|
|
* |
474
|
|
|
* @throws \Acquia\LiftClient\Exception\LiftSdkException |
475
|
|
|
* |
476
|
|
|
* @return \Acquia\LiftClient\Entity\Capture |
477
|
|
|
*/ |
478
|
|
|
public function setPersonalizationGoalValue($personalizationGoalValue) |
479
|
|
|
{ |
480
|
|
|
if (!is_string($personalizationGoalValue)) { |
481
|
|
|
throw new LiftSdkException('Argument must be an instance of string.'); |
482
|
|
|
} |
483
|
|
|
$this['personalization_goal_value'] = $personalizationGoalValue; |
484
|
|
|
|
485
|
|
|
return $this; |
486
|
|
|
} |
487
|
|
|
|
488
|
|
|
/** |
489
|
|
|
* Sets the 'decision_slot_id' parameter. |
490
|
|
|
* |
491
|
18 |
|
* @param string $decisionSlotId Decision Slot Id |
492
|
|
|
* |
493
|
18 |
|
* @throws \Acquia\LiftClient\Exception\LiftSdkException |
494
|
3 |
|
* |
495
|
|
|
* @return \Acquia\LiftClient\Entity\Capture |
496
|
15 |
|
*/ |
497
|
|
|
public function setDecisionSlotId($decisionSlotId) |
498
|
15 |
|
{ |
499
|
|
|
if (!is_string($decisionSlotId)) { |
500
|
|
|
throw new LiftSdkException('Argument must be an instance of string.'); |
501
|
|
|
} |
502
|
|
|
$this['decision_slot_id'] = $decisionSlotId; |
503
|
|
|
|
504
|
|
|
return $this; |
505
|
|
|
} |
506
|
|
|
|
507
|
|
|
/** |
508
|
|
|
* Sets the 'decision_slot_name' parameter. |
509
|
|
|
* |
510
|
18 |
|
* @param string $decisionSlotName Decision Slot Name |
511
|
|
|
* |
512
|
18 |
|
* @throws \Acquia\LiftClient\Exception\LiftSdkException |
513
|
3 |
|
* |
514
|
|
|
* @return \Acquia\LiftClient\Entity\Capture |
515
|
15 |
|
*/ |
516
|
|
|
public function setDecisionSlotName($decisionSlotName) |
517
|
15 |
|
{ |
518
|
|
|
if (!is_string($decisionSlotName)) { |
519
|
|
|
throw new LiftSdkException('Argument must be an instance of string.'); |
520
|
|
|
} |
521
|
|
|
$this['decision_slot_name'] = $decisionSlotName; |
522
|
|
|
|
523
|
|
|
return $this; |
524
|
|
|
} |
525
|
|
|
|
526
|
|
|
/** |
527
|
|
|
* Sets the 'decision_rule_id' parameter. |
528
|
|
|
* |
529
|
18 |
|
* @param string $decisionRuleId Decision Slot Name |
530
|
|
|
* |
531
|
18 |
|
* @throws \Acquia\LiftClient\Exception\LiftSdkException |
532
|
3 |
|
* |
533
|
|
|
* @return \Acquia\LiftClient\Entity\Capture |
534
|
15 |
|
*/ |
535
|
|
|
public function setDecisionRuleId($decisionRuleId) |
536
|
15 |
|
{ |
537
|
|
|
if (!is_string($decisionRuleId)) { |
538
|
|
|
throw new LiftSdkException('Argument must be an instance of string.'); |
539
|
|
|
} |
540
|
|
|
$this['decision_rule_id'] = $decisionRuleId; |
541
|
|
|
|
542
|
|
|
return $this; |
543
|
|
|
} |
544
|
|
|
|
545
|
|
|
/** |
546
|
|
|
* Sets the 'decision_rule_name' parameter. |
547
|
|
|
* |
548
|
18 |
|
* @param string $decisionRuleName Decision Slot Name |
549
|
|
|
* |
550
|
18 |
|
* @throws \Acquia\LiftClient\Exception\LiftSdkException |
551
|
3 |
|
* |
552
|
|
|
* @return \Acquia\LiftClient\Entity\Capture |
553
|
15 |
|
*/ |
554
|
|
|
public function setDecisionRuleName($decisionRuleName) |
555
|
15 |
|
{ |
556
|
|
|
if (!is_string($decisionRuleName)) { |
557
|
|
|
throw new LiftSdkException('Argument must be an instance of string.'); |
558
|
|
|
} |
559
|
|
|
$this['decision_rule_name'] = $decisionRuleName; |
560
|
|
|
|
561
|
|
|
return $this; |
562
|
|
|
} |
563
|
|
|
|
564
|
|
|
/** |
565
|
|
|
* Sets the 'decision_content_id' parameter. |
566
|
|
|
* |
567
|
18 |
|
* @param string $decisionContentId Decision Content Id |
568
|
|
|
* |
569
|
18 |
|
* @throws \Acquia\LiftClient\Exception\LiftSdkException |
570
|
3 |
|
* |
571
|
|
|
* @return \Acquia\LiftClient\Entity\Capture |
572
|
15 |
|
*/ |
573
|
|
|
public function setDecisionContentId($decisionContentId) |
574
|
15 |
|
{ |
575
|
|
|
if (!is_string($decisionContentId)) { |
576
|
|
|
throw new LiftSdkException('Argument must be an instance of string.'); |
577
|
|
|
} |
578
|
|
|
$this['decision_content_id'] = $decisionContentId; |
579
|
|
|
|
580
|
|
|
return $this; |
581
|
|
|
} |
582
|
|
|
|
583
|
|
|
/** |
584
|
|
|
* Sets the 'decision_content_name' parameter. |
585
|
|
|
* |
586
|
18 |
|
* @param string $decisionContentName Decision Content Name |
587
|
|
|
* |
588
|
18 |
|
* @throws \Acquia\LiftClient\Exception\LiftSdkException |
589
|
3 |
|
* |
590
|
|
|
* @return \Acquia\LiftClient\Entity\Capture |
591
|
15 |
|
*/ |
592
|
|
|
public function setDecisionContentName($decisionContentName) |
593
|
15 |
|
{ |
594
|
|
|
if (!is_string($decisionContentName)) { |
595
|
|
|
throw new LiftSdkException('Argument must be an instance of string.'); |
596
|
|
|
} |
597
|
|
|
$this['decision_content_name'] = $decisionContentName; |
598
|
|
|
|
599
|
|
|
return $this; |
600
|
|
|
} |
601
|
|
|
|
602
|
|
|
/** |
603
|
|
|
* Sets the 'decision_goal_id' parameter. |
604
|
|
|
* |
605
|
18 |
|
* @param string $decisionGoalId Decision Goal Id |
606
|
|
|
* |
607
|
18 |
|
* @throws \Acquia\LiftClient\Exception\LiftSdkException |
608
|
3 |
|
* |
609
|
|
|
* @return \Acquia\LiftClient\Entity\Capture |
610
|
15 |
|
*/ |
611
|
|
|
public function setDecisionGoalId($decisionGoalId) |
612
|
15 |
|
{ |
613
|
|
|
if (!is_string($decisionGoalId)) { |
614
|
|
|
throw new LiftSdkException('Argument must be an instance of string.'); |
615
|
|
|
} |
616
|
|
|
$this['decision_goal_id'] = $decisionGoalId; |
617
|
|
|
|
618
|
|
|
return $this; |
619
|
|
|
} |
620
|
|
|
|
621
|
|
|
/** |
622
|
|
|
* Sets the 'decision_goal_name' parameter. |
623
|
|
|
* |
624
|
18 |
|
* @param string $decisionGoalName Decision Goal Name |
625
|
|
|
* |
626
|
18 |
|
* @throws \Acquia\LiftClient\Exception\LiftSdkException |
627
|
3 |
|
* |
628
|
|
|
* @return \Acquia\LiftClient\Entity\Capture |
629
|
15 |
|
*/ |
630
|
|
|
public function setDecisionGoalName($decisionGoalName) |
631
|
15 |
|
{ |
632
|
|
|
if (!is_string($decisionGoalName)) { |
633
|
|
|
throw new LiftSdkException('Argument must be an instance of string.'); |
634
|
|
|
} |
635
|
|
|
$this['decision_goal_name'] = $decisionGoalName; |
636
|
|
|
|
637
|
|
|
return $this; |
638
|
|
|
} |
639
|
|
|
|
640
|
|
|
/** |
641
|
|
|
* Sets the 'decision_goal_value' parameter. |
642
|
|
|
* |
643
|
18 |
|
* @param string $decisionGoalValue Decision Goal Value |
644
|
|
|
* |
645
|
18 |
|
* @throws \Acquia\LiftClient\Exception\LiftSdkException |
646
|
3 |
|
* |
647
|
|
|
* @return \Acquia\LiftClient\Entity\Capture |
648
|
15 |
|
*/ |
649
|
|
|
public function setDecisionGoalValue($decisionGoalValue) |
650
|
15 |
|
{ |
651
|
|
|
if (!is_string($decisionGoalValue)) { |
652
|
|
|
throw new LiftSdkException('Argument must be an instance of string.'); |
653
|
|
|
} |
654
|
|
|
$this['decision_goal_value'] = $decisionGoalValue; |
655
|
|
|
|
656
|
|
|
return $this; |
657
|
|
|
} |
658
|
|
|
|
659
|
|
|
/** |
660
|
|
|
* Sets the 'decision_view_mode' parameter. |
661
|
|
|
* |
662
|
18 |
|
* @param string $decisionViewMode Decision View Mode |
663
|
|
|
* |
664
|
18 |
|
* @throws \Acquia\LiftClient\Exception\LiftSdkException |
665
|
3 |
|
* |
666
|
|
|
* @return \Acquia\LiftClient\Entity\Capture |
667
|
15 |
|
*/ |
668
|
|
|
public function setDecisionViewMode($decisionViewMode) |
669
|
15 |
|
{ |
670
|
|
|
if (!is_string($decisionViewMode)) { |
671
|
|
|
throw new LiftSdkException('Argument must be an instance of string.'); |
672
|
|
|
} |
673
|
|
|
$this['decision_view_mode'] = $decisionViewMode; |
674
|
|
|
|
675
|
|
|
return $this; |
676
|
|
|
} |
677
|
|
|
|
678
|
|
|
/** |
679
|
|
|
* Sets the 'decision_policy' parameter. |
680
|
|
|
* |
681
|
18 |
|
* @param string $decisionPolicy The decision policy used - for example, explore or target |
682
|
|
|
* |
683
|
18 |
|
* @throws \Acquia\LiftClient\Exception\LiftSdkException |
684
|
3 |
|
* |
685
|
|
|
* @return \Acquia\LiftClient\Entity\Capture |
686
|
15 |
|
*/ |
687
|
|
|
public function setDecisionPolicy($decisionPolicy) |
688
|
15 |
|
{ |
689
|
|
|
if (!is_string($decisionPolicy)) { |
690
|
|
|
throw new LiftSdkException('Argument must be an instance of string.'); |
691
|
|
|
} |
692
|
|
|
$this['decision_policy'] = $decisionPolicy; |
693
|
|
|
|
694
|
|
|
return $this; |
695
|
|
|
} |
696
|
|
|
|
697
|
|
|
/** |
698
|
|
|
* Sets the 'capture_identifier' parameter. |
699
|
|
|
* |
700
|
18 |
|
* @param string $captureIdentifier Unique identifier for the capture |
701
|
|
|
* |
702
|
18 |
|
* @throws \Acquia\LiftClient\Exception\LiftSdkException |
703
|
3 |
|
* |
704
|
|
|
* @return \Acquia\LiftClient\Entity\Capture |
705
|
15 |
|
*/ |
706
|
|
|
public function setCaptureIdentifier($captureIdentifier) |
707
|
15 |
|
{ |
708
|
|
|
if (!is_string($captureIdentifier)) { |
709
|
|
|
throw new LiftSdkException('Argument must be an instance of string.'); |
710
|
|
|
} |
711
|
|
|
$this['capture_identifier'] = $captureIdentifier; |
712
|
|
|
|
713
|
|
|
return $this; |
714
|
|
|
} |
715
|
|
|
|
716
|
|
|
/** |
717
|
|
|
* Sets the 'client_timezone' parameter. |
718
|
|
|
* |
719
|
18 |
|
* @param string $clientTimezone Client Timezone |
720
|
|
|
* |
721
|
18 |
|
* @throws \Acquia\LiftClient\Exception\LiftSdkException |
722
|
3 |
|
* |
723
|
|
|
* @return \Acquia\LiftClient\Entity\Capture |
724
|
15 |
|
*/ |
725
|
|
|
public function setClientTimezone($clientTimezone) |
726
|
15 |
|
{ |
727
|
|
|
if (!is_string($clientTimezone)) { |
728
|
|
|
throw new LiftSdkException('Argument must be an instance of string.'); |
729
|
|
|
} |
730
|
|
|
$this['client_timezone'] = $clientTimezone; |
731
|
|
|
|
732
|
|
|
return $this; |
733
|
|
|
} |
734
|
|
|
|
735
|
|
|
/** |
736
|
|
|
* Sets the 'javascript_version' parameter. |
737
|
|
|
* |
738
|
18 |
|
* @param string $javascriptVersion version of the javascript that generated the capture |
739
|
|
|
* |
740
|
18 |
|
* @throws \Acquia\LiftClient\Exception\LiftSdkException |
741
|
3 |
|
* |
742
|
|
|
* @return \Acquia\LiftClient\Entity\Capture |
743
|
15 |
|
*/ |
744
|
|
|
public function setJavascriptVersion($javascriptVersion) |
745
|
15 |
|
{ |
746
|
|
|
if (!is_string($javascriptVersion)) { |
747
|
|
|
throw new LiftSdkException('Argument must be an instance of string.'); |
748
|
|
|
} |
749
|
|
|
$this['javascript_version'] = $javascriptVersion; |
750
|
|
|
|
751
|
|
|
return $this; |
752
|
|
|
} |
753
|
|
|
|
754
|
|
|
/** |
755
|
|
|
* Sets the 'post_id' parameter. |
756
|
|
|
* |
757
|
18 |
|
* @param string $postId Post id of an article |
758
|
|
|
* |
759
|
18 |
|
* @throws \Acquia\LiftClient\Exception\LiftSdkException |
760
|
3 |
|
* |
761
|
|
|
* @return \Acquia\LiftClient\Entity\Capture |
762
|
15 |
|
*/ |
763
|
|
|
public function setPostId($postId) |
764
|
15 |
|
{ |
765
|
|
|
if (!is_string($postId)) { |
766
|
|
|
throw new LiftSdkException('Argument must be an instance of string.'); |
767
|
|
|
} |
768
|
|
|
$this['post_id'] = $postId; |
769
|
|
|
|
770
|
|
|
return $this; |
771
|
|
|
} |
772
|
|
|
|
773
|
|
|
/** |
774
|
|
|
* Sets the 'content_id' parameter. |
775
|
|
|
* |
776
|
18 |
|
* @param string $contentId Content id of an article |
777
|
|
|
* |
778
|
18 |
|
* @throws \Acquia\LiftClient\Exception\LiftSdkException |
779
|
3 |
|
* |
780
|
|
|
* @return \Acquia\LiftClient\Entity\Capture |
781
|
15 |
|
*/ |
782
|
|
View Code Duplication |
public function setContentId($contentId) |
783
|
15 |
|
{ |
784
|
|
|
if (!is_string($contentId)) { |
785
|
|
|
throw new LiftSdkException('Argument must be an instance of string.'); |
786
|
|
|
} |
787
|
|
|
$this['content_id'] = $contentId; |
788
|
|
|
|
789
|
|
|
return $this; |
790
|
|
|
} |
791
|
|
|
|
792
|
|
|
/** |
793
|
|
|
* Sets the 'content_uuid' parameter. |
794
|
|
|
* |
795
|
18 |
|
* @param string $contentUuid UUID of an article |
796
|
|
|
* |
797
|
18 |
|
* @throws \Acquia\LiftClient\Exception\LiftSdkException |
798
|
3 |
|
* |
799
|
|
|
* @return \Acquia\LiftClient\Entity\Capture |
800
|
15 |
|
*/ |
801
|
|
|
public function setContentUuid($contentUuid) |
802
|
15 |
|
{ |
803
|
|
|
if (!preg_match(self::UUID_PATTERN, $contentUuid)) { |
804
|
|
|
throw new LiftSdkException('Argument must be an instance of valid UUID.'); |
805
|
|
|
} |
806
|
|
|
$this['content_uuid'] = $contentUuid; |
807
|
|
|
|
808
|
|
|
return $this; |
809
|
|
|
} |
810
|
|
|
|
811
|
|
|
/** |
812
|
|
|
* Sets the 'content_type' parameter. |
813
|
|
|
* |
814
|
18 |
|
* @param string $contentType Content-type to which a piece of visitor-viewed content belongs |
815
|
|
|
* |
816
|
18 |
|
* @throws \Acquia\LiftClient\Exception\LiftSdkException |
817
|
3 |
|
* |
818
|
|
|
* @return \Acquia\LiftClient\Entity\Capture |
819
|
15 |
|
*/ |
820
|
|
|
public function setContentType($contentType) |
821
|
15 |
|
{ |
822
|
|
|
if (!is_string($contentType)) { |
823
|
|
|
throw new LiftSdkException('Argument must be an instance of string.'); |
824
|
|
|
} |
825
|
|
|
$this['content_type'] = $contentType; |
826
|
|
|
|
827
|
|
|
return $this; |
828
|
|
|
} |
829
|
|
|
|
830
|
|
|
/** |
831
|
|
|
* Sets the 'content_section' parameter. |
832
|
|
|
* |
833
|
18 |
|
* @param string $contentSection Content section of an article |
834
|
|
|
* |
835
|
18 |
|
* @throws \Acquia\LiftClient\Exception\LiftSdkException |
836
|
3 |
|
* |
837
|
|
|
* @return \Acquia\LiftClient\Entity\Capture |
838
|
15 |
|
*/ |
839
|
|
|
public function setContentSection($contentSection) |
840
|
15 |
|
{ |
841
|
|
|
if (!is_string($contentSection)) { |
842
|
|
|
throw new LiftSdkException('Argument must be an instance of string.'); |
843
|
|
|
} |
844
|
|
|
$this['content_section'] = $contentSection; |
845
|
|
|
|
846
|
|
|
return $this; |
847
|
|
|
} |
848
|
|
|
|
849
|
|
|
/** |
850
|
|
|
* Sets the 'content_keywords' parameter. |
851
|
|
|
* |
852
|
18 |
|
* @param string $contentKeywords Content keywords of an article |
853
|
|
|
* |
854
|
18 |
|
* @throws \Acquia\LiftClient\Exception\LiftSdkException |
855
|
3 |
|
* |
856
|
|
|
* @return \Acquia\LiftClient\Entity\Capture |
857
|
15 |
|
*/ |
858
|
|
|
public function setContentKeywords($contentKeywords) |
859
|
15 |
|
{ |
860
|
|
|
if (!is_string($contentKeywords)) { |
861
|
|
|
throw new LiftSdkException('Argument must be an instance of string.'); |
862
|
|
|
} |
863
|
|
|
$this['content_keywords'] = $contentKeywords; |
864
|
|
|
|
865
|
|
|
return $this; |
866
|
|
|
} |
867
|
|
|
|
868
|
|
|
/** |
869
|
|
|
* Sets the 'author' parameter. |
870
|
|
|
* |
871
|
24 |
|
* @param string $author Author of an article |
872
|
|
|
* |
873
|
24 |
|
* @throws \Acquia\LiftClient\Exception\LiftSdkException |
874
|
3 |
|
* |
875
|
|
|
* @return \Acquia\LiftClient\Entity\Capture |
876
|
21 |
|
*/ |
877
|
|
|
public function setAuthor($author) |
878
|
21 |
|
{ |
879
|
|
|
if (!is_string($author)) { |
880
|
|
|
throw new LiftSdkException('Argument must be an instance of string.'); |
881
|
|
|
} |
882
|
|
|
$this['author'] = $author; |
883
|
|
|
|
884
|
|
|
return $this; |
885
|
|
|
} |
886
|
|
|
|
887
|
|
|
/** |
888
|
|
|
* Sets the 'page_type' parameter. |
889
|
|
|
* |
890
|
18 |
|
* @param string $pageType Category of page the visitor viewed (examples include article page, tag page, and home page) |
891
|
|
|
* |
892
|
18 |
|
* @throws \Acquia\LiftClient\Exception\LiftSdkException |
893
|
3 |
|
* |
894
|
|
|
* @return \Acquia\LiftClient\Entity\Capture |
895
|
15 |
|
*/ |
896
|
|
|
public function setPageType($pageType) |
897
|
15 |
|
{ |
898
|
|
|
if (!is_string($pageType)) { |
899
|
|
|
throw new LiftSdkException('Argument must be an instance of string.'); |
900
|
|
|
} |
901
|
|
|
$this['page_type'] = $pageType; |
902
|
|
|
|
903
|
|
|
return $this; |
904
|
|
|
} |
905
|
|
|
|
906
|
|
|
/** |
907
|
|
|
* Sets the 'thumbnail_url' parameter. |
908
|
|
|
* |
909
|
18 |
|
* @param string $thumbnailUrl Thumbnail URL of an article |
910
|
|
|
* |
911
|
18 |
|
* @throws \Acquia\LiftClient\Exception\LiftSdkException |
912
|
3 |
|
* |
913
|
|
|
* @return \Acquia\LiftClient\Entity\Capture |
914
|
15 |
|
*/ |
915
|
|
|
public function setThumbnailUrl($thumbnailUrl) |
916
|
15 |
|
{ |
917
|
|
|
if (!is_string($thumbnailUrl)) { |
918
|
|
|
throw new LiftSdkException('Argument must be an instance of string.'); |
919
|
|
|
} |
920
|
|
|
$this['thumbnail_url'] = $thumbnailUrl; |
921
|
|
|
|
922
|
|
|
return $this; |
923
|
|
|
} |
924
|
|
|
|
925
|
|
|
/** |
926
|
|
|
* Sets the 'published_date' parameter. |
927
|
|
|
* |
928
|
15 |
|
* @param DateTime $publishedDate Publish date of an article |
929
|
|
|
* |
930
|
|
|
* @throws \Acquia\LiftClient\Exception\LiftSdkException |
931
|
|
|
* |
932
|
15 |
|
* @return \Acquia\LiftClient\Entity\Capture |
933
|
|
|
*/ |
934
|
15 |
View Code Duplication |
public function setPublishedDate(DateTime $publishedDate) |
935
|
|
|
{ |
936
|
|
|
// Lift Profile Manager is currently accepting this ISO 8601 format: |
937
|
|
|
// "2017-02-07T19:59:53.123456Z". |
938
|
|
|
// "2017-02-07T19:59:53.123Z" (or "2017-02-07T19:59:53.000Z" pre 7.0 ). |
939
|
|
|
// todo: the above comment needs updating |
940
|
|
|
// todo: works for all but hhvm-3.18.5 |
941
|
|
|
$format = 'Y-m-d\TH:i:s.v\Z'; |
942
|
|
|
if (version_compare(phpversion(), '7.0', '<')) { |
943
|
|
|
$format = 'Y-m-d\TH:i:s.000\Z'; |
944
|
|
|
} |
945
|
|
|
$this['published_date'] = $publishedDate->format($format); |
946
|
|
|
|
947
|
|
|
return $this; |
948
|
|
|
} |
949
|
|
|
} |
950
|
|
|
|