Getting started
Our React Native SDK lets you collect user data from mobile apps. It contains over 30 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 account address. Example:
https://example.piwik.pro
.
Install the library
To install the library with React Native, follow these steps:
- Run the following command:
npm install @piwikpro/react-native-piwik-pro-sdk
Set up the tracker
To set up the Piwik PRO tracker, follow these steps:
- Run the following command. Use your account address (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 15 days ago