This is a PHP SDK around Upsight Data Collection API. It provides methods to make the API calls for all the different message types supported by Upsight Analytics.
To get started with the Upsight library, you will need to check-out the
kontagent_api.php file from our GitHub and include it in your project. You will also need to instantiate and configure an instance of the Kontagent object.
<?php // include the library require_once('./kontagent_api.php'); // configure and instantiate Upsight object $ktApi = new KontagentApi($ktApiKey, array('useTestServer' => true, 'validateParams' => true)); ?>
Once you've got your Upsight object integrated and configured you can start using the library. There are two types of methods provided in the library: tracking methods and helper methods.
The tracking methods should get called by your application whenever you need to report an event to Upsight. There is a tracking method available for every message type in the Upsight API. A few examples are:
<?php $ktApi->trackApplicationAdded($userId); $ktApi->trackPageRequest($userId); $ktApi->trackEvent($userId, $eventName, array('value' => 5)); $ktApi->trackRevenue($userId, $value, array('type' => 'credits')); >?
When events happen within your application, you should make the appropriate call to Upsight. We will then crunch and analyze this data in our systems and present them to you in your dashboard.
For a full list of the available tracking methods, refer to the PHP SDK specification.
The library provides a few helper methods for common tasks. Currently the only ones available are:
<?php $ktApi->genUniqueTrackingTag(); $ktApi->genShortUniqueTrackingTag(); >?
These methods will help you generate the tracking tag parameters required to link certain messages together (for example: invite sent -> invite response -> application added).
If you are not instrumenting with the Upsight Facebook SDK and instead instrumenting with this wrapper, you may run into some issues. Please see our Facebook Best Practices page for troubleshooting tips.
If sending a request to HTTPS, set
TRUE in the constructor, just as would set
userTestServer to true when using the test server.