Releases: aawnu/php-ga4
Add class::fromArray() to Events and Items
Add import from array to event or item, making it possible to prebuild events on frontend before passing to backend.
axios.post('/api/ga4', {
addToCart: {
currency: 'EUR',
value: 13.37,
items: [
{
'item_id': 1,
'item_name': 'Cup',
'price': 13.37,
'quantity': 1
}
]
}
})
use AlexWestergaard\PhpGa4\Analytics;
use AlexWestergaard\PhpGa4\Event;
$addToCart = Event\AddToCart::fromArray($_POST['addToCart']);
Analytics::new($measurementId, $apiSecret)->addEvent($addToCart)->post();
What's Changed
Full Changelog: v1.0.8...v1.0.9
Accept responses without body
- Allow responses without a body (Response 204)
- Allow decimal numbers for tax and shipment values
- Update composer links to fit GitHub account renaming
What's Changed
- Production gives HTTP 204 (no content) on a successful post by @jordykouters in #18
- The fields "shipping" and "tax" can both be float values by @jordykouters in #19
New Contributors
- @jordykouters made their first contribution at #18
Full Changelog: v1.0.7...v1.0.8
Preview for Packagist
This update has no functional changes. It's purely to improve information and Packagist
Differentiate between Full and Partial Refund
- Added
isFullRefund
scope toRefund
to help determine ifItems
is a required parameter.
What's Changed
- Add separator between Refund and Partial Refund by @AlexWestergaard in #17
Full Changelog: v1.0.5...v1.0.6
Clean-up and skip too large requests
Minor fixup of Analytics::toArray()
and skipping post-requests too large (exceeds 130kb body size).
Please refer to the previous release for more details about the last modifications.
Cleaner Exception Handling
This update refactors the exception flow of the code in a cleaner and simpler-to-understand way.
The reason for this update is to avoid throwing midways through a process happening on multiple layers, for example $event->toArray()->parent::toArray()
. It is also preferable to avoid throwing exceptions when iterating through multiple post-calls due to multiple Event stacks (Each post-call can contain a maximum of 25 events).
Please use the $debug
parameter when initializing the Analytics
class while configuring your code and events. Just bear in mind that Google Analytics Debug endpoint will only point to direct constraints to their structure and not the data itself.
What's Changed
- Update Exception Handling by @AlexWestergaard in #15
Full Changelog: v1.0.3...v1.0.4
Fix conversion to micro-time from visual string
- Updated
intval("1_000_000")
tointval(strtr("1_000_000", ["_" => ""])
so PHP converts it to1,000,000
instead of1
Full Changelog: v1.0.2...v1.0.3
Better support for PHP 7.0+ and GA4 Events
- Added
PHP 7.1
to workflow testing - Added strict check on timestamp being within 3 days limitation (*Reference)
- Added support for unlimited Events on the main Analytics class by sending events in batches of 25 (*Reference)
- Updated Composer.json with package versions that support all supported PHP Versions
- Updated PHPUnit Tests to fit the above changes and validate more requirements
- Removed
?\Throwable
type fromGA4Exception
, be vary of usage as it still requires a matching type
What's Changed
- V1.x: Extend Testing & Update Found Issues by @AlexWestergaard in #10
- Rework event limiter by chunking events on posting to Google Analytics by @AlexWestergaard in #12
- Update Composer & CI Workflow by @AlexWestergaard in #13
Full Changelog: v1.0.1...v1.0.2
Update timestamp as microtime
Fixing the issue where microtime is not the proper format as 1*1000000 instead of 1*1000 and this resulted in events not being used as they are older than 3 days in microtime.
What's Changed
- Update timestamp to microtime format by @AlexWestergaard in #8
Full Changelog: v1.0.0...v1.0.1