PHP code example of placetopay / analytics-tracker
1. Go to this page and download the library: Download placetopay/analytics-tracker library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
placetopay / analytics-tracker example snippets
use Placetopay\AnalyticsTracker\Facades\Analytics;
Analytics::setIdentifier("[email protected]") // (optional) Associate a user to the tracked events
->setDefaultPayload(['key' => 'value']) // Set the default data to be sent on every track call
->track('Label', ['key' => 'value']); // Tracks an event
use Placetopay\AnalyticsTracker\Facades\Analytics;
Analytics::setIdentifier("[email protected]")
->shouldTrackEvents(fn($label, $payload) => $payload['siteId'] === '1234')
->track('Label', ['siteId' => '5678']);
Analytics::setIdentifier("[email protected]")
->shouldTrackEvents(new InvokableClass()) // May use an Invokable class
->track('Label', ['siteId' => '5678']);