forked from PostHog/posthog-php
-
Notifications
You must be signed in to change notification settings - Fork 0
/
example.php
54 lines (44 loc) · 1.18 KB
/
example.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
<?php
require_once __DIR__ . '/vendor/autoload.php';
use PostHog\PostHog;
const PROJECT_API_KEY = "phc_LBp6TCrkZahJAGVGovQBeNfDIap2hD1ymNjoOftoCow";
const PERSONAL_API_KEY = "phx_pWOpWbl64FJqmRinGtGpPvceve1wqKyqUxwYPdWho86";
PostHog::init(
PROJECT_API_KEY,
array('host' => 'https://app.posthog.com', 'debug' => true),
null,
PERSONAL_API_KEY
);
# Capture an event
PostHog::capture(
[
'distinctId' => 'distinct_id',
'event' => 'event',
'properties' => [
'property1' => 'value',
'property2' => 'value',
],
// 'groups' => [
// 'org' => 123
// ],
// 'sendFeatureFlags' => true
// 'sendFeatureFlags' => true
'send_feature_flags' => true
]
);
// PostHog::capture(
// [
// 'distinctId' => 'distinct_id',
// 'event' => 'event2',
// 'properties' => [
// 'property1' => 'value',
// 'property2' => 'value',
// ],
// // 'groups' => [
// // 'org' => 123
// // ],
// 'sendFeatureFlags' => false
// ]
// );
$enabled = PostHog::getFeatureFlag("first", "user_2311144");
echo $enabled;