Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
hehex9 committed Apr 2, 2021
1 parent 2bc5abf commit c84068b
Showing 1 changed file with 31 additions and 4 deletions.
35 changes: 31 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# react-native-baidu-mtj

react-native wrapper for baidu-mtj sdk
react-native wrapper for [Baidu Mobile Analytics SDK](https://mtj.baidu.com/web/sdk/index)(百度移动统计)

## Installation

Expand All @@ -10,12 +10,39 @@ yarn add @youjinbu/react-native-baidu-mtj

## Usage

### Basic Usage
(see [example](/example))

```js
import BaiduMtj from "@youjinbu/react-native-baidu-mtj";
import BaiduMtj from "@youjinbu/react-native-baidu-mtj"

BaiduMtj.start('app key')

// ...
export function SomeScreen() {
useEffect(() => {
// listen to focus event
navigation.onFocus(() => {
BaiduMtj.pageStart('home')
})
return () => BaiduMtj.pageEnd('home')
}, [])

return <View />
}
```

const result = await BaiduMtj.multiply(3, 7);
### Supported Methods

```typescript
declare const Analytics: {
start(appKey: string, debug?: boolean): void;
setUserId(userId: string): void;
pageStart(pageName: string): void;
pageEnd(pageName: string): void;
event(eventId: string, label: string): void;
eventStart(eventId: string, label: string): void;
eventEnd(eventId: string, label: string): void;
};
```

## License
Expand Down

0 comments on commit c84068b

Please sign in to comment.