npm i --save @duicorn/nativescript-posthog
- Version: 3.4.17
- GitHub: https://github.com/NativeScript/plugins
- NPM: https://www.npmjs.com/package/%40duicorn%2Fnativescript-posthog
- Downloads:
- Last Day: 0
- Last Week: 20
- Last Month: 26
@duicorn/nativescript-posthog
npm install @duicorn/nativescript-posthog
Usage
// posthog.ts
import { PostHog } from "@duicorn/nativescript-posthog"
export const posthog = new PostHog('<ph_project_api_key>', {
// usually 'https://app.posthog.com' or 'https://eu.posthog.com'
host: '<ph_instance_address>',
autocapture: false
})
import { posthog } from 'posthog.ts';
posthog.capture('something clicked');
posthog.identify({
userProperties: { email: "[email protected]" }
});
posthog.isFeatureEnabled('myfeature');
Autocapture
This plugin implements a simple auto-capture feature for NativeScript apps. To enable it set up the PostHog object with autocapture: true
.
To opt out tap-elements you can add the attribute posthogAutoCapture="false"
to that element