$ npm install odemolliens/react-native-adobe-analytics --save
$ react-native link react-native-adobe-analytics
- In XCode, in the project navigator, right click
Libraries
➜Add Files to [your project's name]
. Check onlyCopy items if needed
. - In XCode, in the project navigator, select your project. Add
libRNAdobeAnalytics.a
to your project'sBuild Phases
➜Link Binary With Libraries
- In XCode, in the project navigator, select your project. Add
libsqlite3.0.tbd
to your project'sBuild Phases
➜Link Binary With Libraries
- In XCode, in the project navigator, select your project. Add
SystemConfiguration.framework
to your project'sBuild Phases
➜Link Binary With Libraries
- In XCode, in the project navigator, select your project. Drag and drop your json config file
ADBMobileConfig.json
and check onlyCopy items if needed
. - Run your project (
Cmd+R
)<
- Open up
android/app/src/main/java/[...]/MainActivity.java
- Add
import com.odemolliens.rn.adobe.analytics.RNAdobeAnalyticsPackage;
to the imports at the top of the file - Add
new RNAdobeAnalyticsPackage()
to the list returned by thegetPackages()
method
- Append the following lines to
android/settings.gradle
:include ':react-native-adobe-analytics' project(':react-native-adobe-analytics').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-adobe-analytics/android')
- Insert the following lines inside the dependencies block in
android/app/build.gradle
:compile project(':react-native-adobe-analytics')
- Open (or create it if it's not the case)
YOUR_APP/app/src/main/res/raw
and add your json config fileadbmobileconfig.json
(file's name need to contain only lowercase)
```js
import { Adobe } from 'react-native-adobe-analytics';
```
Adobe Analysis must be initialized as soon as the mobile application has started:
```js
import { Adobe } from 'react-native-adobe-analytics';
export default class App {
constructor() {
super()
// If you know it, add your packageName. Otherwise enter a blank string ''.
var packageName : string = 'com.sample'
Adobe.init(packageName);
}
}
```
In any js file, you can start to use this plugin by adding:
```js
import { Adobe } from 'react-native-adobe-analytics';
```
In any js file, you can track events by using:
```js
Adobe.trackEvent('my_event', null);
```
Can be used with extra parameters:
```js
const extraParameters = { 'screen.category.l1': 'cat1', 'screen.category.l2': 'cat2', 'screen.category.l3': 'cat3', 'screen.category.l4': 'cat4' };
Adobe.trackEvent('my_event',extraParameters);
```
In any js file, you can track views by using:
```js
Adobe.trackState('my_view_name',null);
```
Can be used with extra parameters:
```js
const extraParameters = { 'screen.category.l1': 'cat1', 'screen.category.l2': 'cat2', 'screen.category.l3': 'cat3', 'screen.category.l4': 'cat4' };
Adobe.trackState("my_view_name", extraParameters);
```
- Library created
- Can change adobe's config file by environment on ios
- Can change adobe's config file by environment on android