diff --git a/src/Dto/SegmentPayload.php b/src/Dto/SegmentPayload.php index 091ecdf..7d294bf 100644 --- a/src/Dto/SegmentPayload.php +++ b/src/Dto/SegmentPayload.php @@ -24,10 +24,11 @@ class SegmentPayload extends DataTransferObject public function toSegment(): array { - return array_merge([ + return array_merge( + [ 'event' => $this->name, 'properties' => $this->properties, - 'anonymousId' => $this->actor ?? Str::uuid()->__toString() + 'anonymousId' => $this->actor ?? Str::uuid()->__toString(), ], ($this->actor ? ['userId' => $this->actor] : []), ($this->messageId ? ['messageId' => $this->messageId] : []), @@ -68,7 +69,7 @@ public function messageId(?string $messageId): self return $this; } - + public function track(): bool { return $this->sent = Segment::track($this->toSegment());