Skip to content

Commit 0c14639

Browse files
committed
Add option for session_id and engagement_time_msec params in events
1 parent 5b1093b commit 0c14639

File tree

2 files changed

+35
-0
lines changed

2 files changed

+35
-0
lines changed

src/Facade/Type/DefaultEventParamsType.php

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,5 +44,25 @@ public function setPageTitle(string $title);
4444
*/
4545
public function setScreenResolution(string $wxh);
4646

47+
/**
48+
* In order for user activity to display in reports like Realtime, \
49+
* "session_id" must be supplied as part of the params for an event. \
50+
* The "session_id" is supplied from the reserved "session_start" event.
51+
*
52+
* @var session_id
53+
* @param string $id eg. "123"
54+
*/
55+
public function setSessionId(string $id);
56+
57+
/**
58+
* In order for user activity to display in reports like Realtime, \
59+
* "engagement_time_msec" must be supplied as part of the params for an event. \
60+
* The "engagement_time_msec" parameter should reflect the event's engagement time in milliseconds.
61+
*
62+
* @var engagement_time_msec
63+
* @param string $msec eg. '150' for 150 milliseconds
64+
*/
65+
public function setEngagementTimeMSec(int $msec);
66+
4767
public function toArray(): array;
4868
}

src/Helper/EventHelper.php

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@ abstract class EventHelper extends IOHelper implements EventType
1515
protected null|string $page_title;
1616
protected null|string $screen_resolution;
1717

18+
protected null|string $session_id;
19+
protected null|int $engagement_time_msec;
20+
1821
protected array $campaign = [];
1922

2023
public function setLanguage(string $lang)
@@ -60,6 +63,18 @@ public function setEventPage(DefaultEventParamsType $page)
6063
return $this;
6164
}
6265

66+
public function setSessionId(string $id)
67+
{
68+
$this->session_id = $id;
69+
return $this;
70+
}
71+
72+
public function setEngagementTimeMSec(int $msec)
73+
{
74+
$this->engagement_time_msec = $msec;
75+
return $this;
76+
}
77+
6378
public function toArray(): array
6479
{
6580
$return = [];

0 commit comments

Comments
 (0)