Getting started
Our React Native SDK lets you collect user data from mobile apps. It contains over 40 methods that make it easy to track screen views, goals, ecommerce orders and more. To get started, you need to set up your account in Piwik PRO, install our library and set up the tracker.
Set up Piwik PRO
Before you install our library for React Native, you need to set up Piwik PRO. Here's what you need to do:
- Log in to Piwik PRO.
- Go to Menu > Administration.
- Navigate to Sites & apps.
- Click Add a site or app.
- Type the app name and address, and click Save.
- Set the time zone and currency.
- Note the site/app ID. The ID is under the app name. Example:
00000000-0000-0000-0000-000000000000. - Note your tracking endpoint URL. This is the base URL where the SDK sends collected events. By default, it's the same as your Piwik PRO instance address, for example,
https://example.piwik.pro. If your organization uses a custom tracking endpoint, check with your Piwik PRO administrator.
Install the library
To install the library with React Native, follow these steps:
- Run the following command:
npm install @piwikpro/react-native-piwik-pro-sdkSet up the tracker
To set up the Piwik PRO tracker, follow these steps:
- Run the following command. Provide your tracking endpoint URL , which is the the base URL where the SDK sends events, for example,
https://example.piwik.pro/, and the site/app ID (Where to find it?).
import PiwikProSdk from "@piwikpro/react-native-piwik-pro-sdk";
// ...
await PiwikProSdk.init('https://example.piwik.pro/', '01234567-89ab-cdef-0123-456789abcdef')Note: Each tracking method returns a Promise that will be rejected if the PiwikProSdk is not initialized.
Updated 3 days ago