Native Bindings for the Localytics Library. Only available on iOS right now.
npm install --save react-native-localyticsreact-native link react-native-localytics- Add Localytics to your ios/podfile file
pod 'Localytics', '~> 4.0' cd ios && pod install- Follow the steps on the Localytics SDK to complete installation. Basically:
- Add the Localytics schemes (optional)
- Add ATS Exception
- Initialize the SDK in your AppDelegate.m (this is the most important step). This is where you will be setuping which app key to use.
Note: CocoaPods installation is also available see at the end.
The method names are named the same as in the iOS SDK. Only a few methods are implemented now, but more to come! If you need somehting particular, just open an issue!
import * as Localytics from 'react-native-localytics';
Localytics.tagEvent('eventName', { more: 'attributes' });Tagging events:
-
tagPurchased({ params?: ItemParams }) -
tagAddedToCart({ params?: ItemParams}) -
tagStartedCheckout({ params?: CheckoutParams }) -
tagCompletedCheckout({ params?: CheckoutParams }) -
tagContentViewed({ params: ContentParams }) -
tagSearched({ params: SearchParams }) -
tagShared({ params: ShareParams }) -
tagContentRated({ params: RatingParams }) -
tagCustomerRegistered({ customer?: Customer, methodName?: string, attributes?: Object }) -
tagCustomerLoggedIn({ customer?: Customer, methodName?: string, attributes: Object }) -
tagCustomerLoggedOut({ attributes?: Object }) -
tagInvited(method: string, attributes?: Object) -
tagEvent(eventName: string, attributes?: Object)
Identifying users:
-
setCustomerId(id: string) -
setCustomerFirstName(name: string) -
setCustomerLastName(name: string) -
setCustomerFullName(name: string) -
setCustomerEmail(email: string) -
setLocation({ lng: number, lat: number })
User profiles:
- setValue
- Numeric value
- Numeric values in a set
- Date value
- Dave values in a set
- String value
- String value in a set
- deleteProfileAttribute
- addValues
- Adding a numeric values to a set
- Adding a date values to a set
- Adding a string values to a set
- removeValues
- Removing numeric values from a set
- Removing date values from a set
- Removing string values from a set
- incrementValueBy
- decrementValueBy
{
customerId?: string,
firstName?: string,
lastName?: string,
fullName?: string,
emailAddress?: string,
}
{
itemName?: string,
itemId?: string,
itemType?: string,
itemPrice?: number,
attributes?: Object,
}
{
totalPrice?: number,
itemCount?: number,
attributes?: Object,
}
{
contentName?: string,
contentId?: string,
contentType?: string,
attributes?: Object,
}
{
searchText?: string,
contentType?: string,
resultCount?: number,
attributes?: Object,
}
{
shareName?: string,
contentId?: string,
contentType?: string,
methodName?: string,
attributes?: Object,
}
{
contentName?: string,
contentId?: string,
contentType?: string,
rating?: number,
attributes?: Object,
}
First install the package with npm npm install react-native-localytics. Then add the following line in your Podfile
pod 'react-native-localytics', :path => '../node_modules/react-native-localytics'
If you need the static build instead of dynamic, use:
pod 'react-native-localytics', :path => '../node_modules/react-native-localytics', :subspecs => [
'Static',
]