V1.0.9: Autoparsing
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