Skip to content

Commit cc5c56e

Browse files
committed
docs: add link for custom user property description and remove chunks
1 parent f99e8af commit cc5c56e

File tree

2 files changed

+5
-9
lines changed

2 files changed

+5
-9
lines changed

src/Analytics.php

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -130,21 +130,16 @@ public function post(): void
130130
["consent" => $this->consent->toArray()],
131131
);
132132

133-
$chunkUserProperties = array_chunk($this->user_properties, 25, true);
134-
$this->user_properties = [];
135-
136133
$chunkEvents = array_chunk($this->events, 25);
137134
$this->events = [];
138135

139-
$chunkMax = count($chunkEvents) > count($chunkUserProperties) ? count($chunkEvents) : count($chunkUserProperties);
140-
141-
for ($chunk = 0; $chunk < $chunkMax; $chunk++) {
142-
$body['user_properties'] = $chunkUserProperties[$chunk] ?? [];
136+
foreach ($chunkEvents as $events) {
137+
$body['user_properties'] = $this->user_properties;
143138
if (empty($body['user_properties'])) {
144139
unset($body['user_properties']);
145140
}
146141

147-
$body['events'] = $chunkEvents[$chunk] ?? [];
142+
$body['events'] = $events;
148143
if (empty($body['events'])) {
149144
unset($body['events']);
150145
}

src/Facade/Type/AnalyticsType.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,11 @@ public function setTimestampMicros(int|float $microOrUnix);
4343
public function setNonPersonalizedAds(bool $allow);
4444

4545
/**
46-
* The user properties for the measurement
46+
* The user properties for the measurement (Up to 25 custom per project, see link)
4747
*
4848
* @var user_properties
4949
* @param AlexWestergaard\PhpGa4\Facade\Type\UserProperty $prop
50+
* @link https://support.google.com/analytics/answer/14240153
5051
*/
5152
public function addUserProperty(UserPropertyType ...$props);
5253

0 commit comments

Comments
 (0)