nudge-core-mobile
v0.0.2
Published
The Nudge Core Mobile Package allows you to integrate experiences provided by Nudge into your React Native Mobile application. With this package, you can engage your users with interactive games and promotions.
Downloads
2
Readme
Overview
The Nudge Core Mobile Package allows you to integrate experiences provided by Nudge into your React Native Mobile application. With this package, you can engage your users with interactive games and promotions.
Getting Started
To get started with the Nudge Web Package, follow these steps:
- Navigate to Nudge's official website to explore the games that you can render through scratch cards.
- Register your product on our website Nudge.
- From the Nudge website, you will obtain a unique secret key. Use this secret key while initializing the package.
Usage
To initialize the NudgeCore class with a reusable variable name and access all its functions through it, follow these steps:
Import the NudgeCore package into your file:
import Nudge from 'nudge-core-mobile';
Create an instance of the NudgeCore class with your desired variable name and add:
token
(required): The secret key obtained from the Nudge website, used for authentication.
let nudge = new Nudge({apiKey: 'YOUR API KEY'});
Initializing session
Whenever a distinct user Id which is used to identify users at the client's end is defined, call the initSession function to initialize the user session.
await nudge.initSession({externalId: 'CLIENT_IDENTIFIABLE_USER_ID'});
You can also send more user attributes along with the user ID for making segments of audiences.
await nudge.initSession({
externalId: 'CLIENT_IDENTIFIABLE_USER_ID',
properties: {
name: 'Client User 1',
age: 27,
gender: 'M',
country: 'US',
},
});
Start Tracking Events
Make sure you have initialized sesstion before tracking
To track an event, simply call
await nudge.track({type: 'EVENT_TYPE'});
You can also add event properties for analytics and .making segments of users based on the properties of their events performed for custom audience experiences.
await nudge.track({
type: 'EVENT_TYPE',
properties: {
product: 'Fortune Cookies',
quantity: 5,
countryOfExport: 'US',
},
});
Get Rewards
Make sure you have initialized sesstion before getting all the rewards
To track all the rewards, simply call
await nudge.getRewardsData();