0.7.1 • Published 1 year ago
@pmu-tech/react-native-piano-analytics v0.7.1
@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-analyticsConfigure 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): voidSet 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(): PrivacyModeSet User
// SET USER:
function setUser(userId: string, category: string, enableStorage: boolean): voidSet Privacy id
// SET PRIVACY ID:
function setVisitorId(visitorId: string): void
// GET PRIVACY ID:
function getVisitorId(): stringSet 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[]): voidSend 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>): voidContributing
Contributions are very welcome! Please refer to guidelines described in the contributing guide.