hostinger / amplitude-php
Installs: 6 674
Dependents: 0
Suggesters: 0
Security: 0
Stars: 3
Watchers: 3
Forks: 11
pkg:composer/hostinger/amplitude-php
Requires
- ext-curl: *
- ext-json: *
- guzzlehttp/guzzle: ^6.2
This package is not auto-updated.
Last update: 2023-11-03 14:59:58 UTC
README
Install
composer require hostinger/amplitude-php
How to use it
require_once 'vendor/autoload.php'; $apiKey = '123'; $amplitudeClient = new Amplitude\AmplitudeClient($apiKey); $amplitudeEvent = new Amplitude\Message\Event(); // For user properties $amplitudeEvent ->set('eventType', 'test.event') ->set('userId', 1) ->set('deviceId', 1) ->set('city_id', 1) ->set('country_id', 1); // For event properties $amplitudeEvent ->addToEventProperties('revenue', 1); try { $response = $amplitudeClient->track($amplitudeEvent); print 'event tracked'; } catch (Exception $e) { print $e->getMessage(); }