You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi, is this how to do a begin checkout in the backend?
use AlexWestergaard\PhpGa4\Exception;
use AlexWestergaard\PhpGa4\Analytics;
use AlexWestergaard\PhpGa4\Event\BeginCheckout;
use AlexWestergaard\PhpGa4\Item;
try {
// If gtag.js, this can be the _ga or _gid cookie
// This can be any kind of session identifier
$session = $_COOKIE['_ga'] ?? $_COOKIE['_gid'] ?? $_COOKIE['PHPSESSID'];
$analytics = Analytics::new( 'G-XXXXXXXX','xYzzX_xYzzXzxyZxX')
->setClientId($session);
$analytics->addEvent(new BeginCheckout);
$analytics->setCurrency('usd');
$analytics->setValue('60.00');
$analytics->addItem([
'item_id' => 'bla bla',
'currency'=> 'USD',
'price' =>'60.00',
'quantity'=> 1
]);
$analytics->post();
} catch (Exception\Ga4Exception $exception) {
// Handle exception
if (YII_DEBUG) dd($exception);
Yii::error($exception);
}
Hi, is this how to do a begin checkout in the backend?
i'm getting this error
how do i fix this? Thank you.
The text was updated successfully, but these errors were encountered: