Documentation IndexFetch the complete documentation index at: /llms.txtUse this file to discover all available pages before exploring further.
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
Track events and list event names with the MailGlyph PHP SDK.
events->track
<?php use MailGlyph\MailGlyph; $tracker = new MailGlyph($_ENV['MAILGLYPH_PUBLIC_KEY']); $result = $tracker->events->track([ 'email' => '[email protected]', 'event' => 'purchase', 'subscribed' => true, 'data' => [ 'product' => 'premium', 'amount' => 99, ], ]); echo $result->contact . PHP_EOL; echo $result->event . PHP_EOL; echo $result->timestamp . PHP_EOL;
events->listNames
<?php use MailGlyph\MailGlyph; $client = new MailGlyph($_ENV['MAILGLYPH_SECRET_KEY']); $eventNames = $client->events->listNames(); print_r($eventNames);
events->getNames
getNames()
listNames()
<?php $eventNames = $client->events->getNames(); print_r($eventNames);
<?php use MailGlyph\Exceptions\AuthenticationException; use MailGlyph\MailGlyph; $client = new MailGlyph($_ENV['MAILGLYPH_SECRET_KEY']); try { $client->events->track([ 'email' => '[email protected]', 'event' => 'signup', ]); } catch (AuthenticationException $error) { echo $error->getMessage() . PHP_EOL; }