Skip to content

Instantly share code, notes, and snippets.

@kirkbeard
Created June 2, 2021 08:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kirkbeard/8f5d3dd0fb0f2a1957960fdefe18a1de to your computer and use it in GitHub Desktop.
Save kirkbeard/8f5d3dd0fb0f2a1957960fdefe18a1de to your computer and use it in GitHub Desktop.
klaviyo-debugging.php
<?php
use Klaviyo\Klaviyo as Klaviyo;
use Klaviyo\Model\EventModel as KlaviyoEvent;
// Reduced test case to remove superfluous code
//
$event = new KlaviyoEvent(
array(
'event' => 'Placed Order',
'customer_properties' => array(
'$email' => 'test4@example.com',
// '$first_name' => 'Thomas',
// '$last_name' => 'Jefferson'
),
'properties' => array(
'Testing API' => true
)
)
);
// dd($event);
$client = new Klaviyo( getenv('KLAVIYO_PRIVATE_KEY'), getenv('KLAVIYO_PUBLIC_KEY') );
// dd($client);
// $y = $client->metrics->getMetrics(); // This returns data
// $y = $client->lists->getLists(); // This returns data
// $y = $client->lists->checkListSubscriptions( getenv('KLAVIYO_LIST_ID'), ['test1@example.com']); // This works
// $z = $client->profiles->getProfile( 'xyzxyzxyzxyzxyz' ); // This works
$x = $client->publicAPI->track( $event ); // <--------------------- Nothing shows up on klaviyo.com
dd($x); // returns '1'
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment