0.5.0 • Published 1 month ago

@pmu-tech/react-native-piano-analytics v0.5.0

Weekly downloads
-
License
MIT
Repository
github
Last release
1 month ago

@pmu-tech/react-native-piano-analytics

React Native Piano Analytics

Installation in managed Expo projects

For managed Expo projects, please follow the installation instructions in the API documentation for the latest stable release. If you follow the link and there is no documentation available then this library is not yet usable within managed projects it is likely to be included in an upcoming Expo SDK release.

Installation in bare React Native projects

For bare React Native projects, you must ensure that you have installed and configured the expo package before continuing.

Add the package to your npm dependencies

npm install @pmu-tech/react-native-piano-analytics

Configure for iOS

Run npx pod-install after installing the npm package.

Usage

You may want to give a try? Run example application in ./example.

import react-native-piano-analytics

import * as PianoAnalytics from '@pmu-tech/react-native-piano-analytics';

Set a configuration (mandatory)

function setConfiguration(collectionName: string, siteId: number): void

Set Privacy consent (mandatory)

By default Piano Analytics will set "no-consent" mode.

type PrivacyMode = 'optin' | 'exempt' | 'no-storage' | 'no-consent' | 'optout';

// SET:
function privacySetMode(mode: PrivacyMode): void

// GET:
function privacyGetMode(): PrivacyMode

Set User

// SET USER:
function setUser(userId: string, category: string, enableStorage: boolean): void

// REMOVE USER:
function deleteUser(): void

Set Privacy id

// SET PRIVACY ID:
function setVisitorId(visitorId: string): void

// GET PRIVACY ID:
function getVisitorId(): string

Set Privacy Property

// SET PRIVACY INCLUDE PROPERTY :
function privacyIncludeProperty(property: string, privacyModes?: string[], eventNames?: string[]): void

// SET PRIVACY INCLUDE PROPERTIES:
function privacyIncludeProperties(properties: [string], privacyModes?: string[], eventNames?: string[]): void

Send events

export type ClickEvents = "click.action" | "click.navigation" | "click.download" | "click.exit";

export type PageEvents = "page.display" | "com.display";

export type EventName = ClickEvents | PageEvents;
function sendEvent(eventName: EventName, params: Record<string, string>): void

Contributing

Contributions are very welcome! Please refer to guidelines described in the contributing guide.

0.5.0

1 month ago

0.4.0

6 months ago

0.3.1

7 months ago

0.2.1

10 months ago

0.2.0

10 months ago

0.1.0

10 months ago