Skip to content

Commit f13977d

Browse files
committed
java example
1 parent 75b8c0d commit f13977d

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

posthog-samples/posthog-java-sample/src/main/java/com/posthog/java/sample/PostHogJavaExample.java

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
import com.posthog.server.PostHogConfig;
66
import com.posthog.server.PostHogFeatureFlagOptions;
77
import com.posthog.server.PostHogInterface;
8-
8+
import com.posthog.server.PostHogSendFeatureFlagOptions;
99
import java.util.HashMap;
1010

1111
/**
@@ -42,6 +42,20 @@ public static void main(String[] args) {
4242
.personProperty("email", "example@example.com")
4343
.build());
4444

45+
postHog.capture(
46+
"distinct-id",
47+
"file_uploaded",
48+
PostHogCaptureOptions
49+
.builder()
50+
.property("file_name", "document.pdf")
51+
.property("file_size", 123456)
52+
.sendFeatureFlags(PostHogSendFeatureFlagOptions
53+
.builder()
54+
.personProperty("email", "example@example.com")
55+
.onlyEvaluateLocally(true)
56+
.build())
57+
.build());
58+
4559
System.out.println("File previews enabled: " + hasFilePreview);
4660

4761
postHog.flush();

0 commit comments

Comments
 (0)