Skip to content

Commit

Permalink
fix: add time field to Assignment event (#17)
Browse files Browse the repository at this point in the history
  • Loading branch information
tyiuhc authored Mar 20, 2024
1 parent ac91224 commit ae78a13
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
4 changes: 3 additions & 1 deletion src/Amplitude/Event.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ class Event
public ?string $userId = null;
public ?string $deviceId = null;
public ?string $insertId = null;
public ?int $time = null;

public function __construct(string $eventType)
{
Expand All @@ -35,7 +36,8 @@ public function toArray(): array
'user_properties' => $this->userProperties,
'user_id' => $this->userId,
'device_id' => $this->deviceId,
'insert_id' => $this->insertId,]);
'insert_id' => $this->insertId,
'time' => $this->time]);
}

/**
Expand Down
3 changes: 2 additions & 1 deletion src/Assignment/Assignment.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
use RuntimeException;
use function AmplitudeExperiment\hashCode;

require_once __DIR__ . '/../Util.php';
require_once __DIR__ . '/../Util.php';
require_once __DIR__ . '/AssignmentService.php';

/**
Expand Down Expand Up @@ -62,6 +62,7 @@ public function toEvent(): Event
$event->deviceId = $this->user->deviceId;
$event->eventProperties = [];
$event->userProperties = [];
$event->time = $this->timestamp;

$set = [];
$unset = [];
Expand Down

0 comments on commit ae78a13

Please sign in to comment.