npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

react-native-baidu-mtj

v2.0.6

Published

百度统计移动端 React Native 版本无埋点 SDK,解决了官方 RN 模块版本过低的问题,并加入了 ts 支持

Downloads

11

Readme

react-native-baidu-mtj

百度统计移动端 React Native 版本无埋点 SDK,解决了官方 RN 模块版本过低的问题,并加入了 ts 支持

使用方法

安装

$ yarn add react-native-baidu-mtj

低版本 React Native 需要手动建立连接

$ react-native link react-native-baidu-mtj

Android 端部署

配置AndroidManifest.xml:

1)添加权限声明

<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.BLUETOOTH" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.WRITE_SETTINGS" />
<uses-permission android:name="android.permission.GET_TASKS" />

2)添加业务配置

<!-- 您从百度网站获取的APP KEY,根据实际您的APP申请的APP_KEY进行修改 -->
<meta-data
		android:name="BaiduMobAd_STAT_ID"
		android:value="a9e2ad84a2" /> 

<!-- 渠道商编号 -->
<meta-data
		android:name="BaiduMobAd_CHANNEL"
		android:value="Baidu Market" />

<!-- 是否开启错误日志统计,默认为false -->
<meta-data
		android:name="BaiduMobAd_EXCEPTION_LOG"
		android:value="true" />

<!-- 日志仅在wifi网络下发送,默认为false -->
<meta-data
		android:name="BaiduMobAd_ONLY_WIFI"
		android:value="false" />

<!-- 是否获取基站位置信息 ,默认为true -->
<meta-data
		android:name="BaiduMobAd_CELL_LOCATION"
		android:value="true" />

<!-- 是否获取GPS位置信息,默认为true -->
<meta-data
		android:name="BaiduMobAd_GPS_LOCATION"
		android:value="true" />

<!-- 是否获取WIFI位置信息,默认为true -->
<meta-data
		android:name="BaiduMobAd_WIFI_LOCATION"
		android:value="true" />

3)App 中调用

import RNBaiduMtj from "react-native-baidu-mtj"
// ... ...
RNBaiduMtj.start()

IOS 端部署

1)手动安装 pod 依赖

cd yourReactNativeProject/ios/
pod install

2)到主Target下,切到Build Settings,找到Linking部分的Other Linker Flags条目,双击后加入-ObjC配置。

3)编辑info.plist配置文件:打开主工程下Supporting Files文件夹下的info.plist文件,按照如下示例,新增mtj_appkey、mtj_deubglog两行参数,并写入您的appkey

API

参考官方文档:

  • https://mtj.baidu.com/static/userguide/book/android/bconfig/api.html
  • https://mtj.baidu.com/static/userguide/book/ios/bconfig/api.html