Search by

hostinger / amplitude-php

fordnoxrytisderalgirdasci

This package is abandoned and no longer maintained. No replacement package was suggested.
There is no license information available for the latest version (1.0.0) of this package.

Package info

github.com/hostinger/Amplitude-PHP

pkg:composer/hostinger/amplitude-php

Statistics

Installs: 6 697

Dependents: 0

Suggesters: 0

Stars: 3

1.0.0 2016-06-13 15:20 UTC

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();
}