Skip to content

Commit ae78a13

Browse files
authored
fix: add time field to Assignment event (#17)
1 parent ac91224 commit ae78a13

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

src/Amplitude/Event.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ class Event
1818
public ?string $userId = null;
1919
public ?string $deviceId = null;
2020
public ?string $insertId = null;
21+
public ?int $time = null;
2122

2223
public function __construct(string $eventType)
2324
{
@@ -35,7 +36,8 @@ public function toArray(): array
3536
'user_properties' => $this->userProperties,
3637
'user_id' => $this->userId,
3738
'device_id' => $this->deviceId,
38-
'insert_id' => $this->insertId,]);
39+
'insert_id' => $this->insertId,
40+
'time' => $this->time]);
3941
}
4042

4143
/**

src/Assignment/Assignment.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
use RuntimeException;
99
use function AmplitudeExperiment\hashCode;
1010

11-
require_once __DIR__ . '/../Util.php';
11+
require_once __DIR__ . '/../Util.php';
1212
require_once __DIR__ . '/AssignmentService.php';
1313

1414
/**
@@ -62,6 +62,7 @@ public function toEvent(): Event
6262
$event->deviceId = $this->user->deviceId;
6363
$event->eventProperties = [];
6464
$event->userProperties = [];
65+
$event->time = $this->timestamp;
6566

6667
$set = [];
6768
$unset = [];

0 commit comments

Comments
 (0)