@pmu-tech/react-native-piano-analytics
v0.7.1
Published
Piano Analytics
Downloads
7
Readme
@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
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.