2017-08-03 50 views

回答

0

解決了它的android 在此刻react-native-google-analytics-bridge沒有sessionControl api。要添加下面查找文件內作出反應,本機谷歌,分析橋夾

GoogleAnalyticsBridge.java並添加

@ReactMethod 
public void createNewSession(String trackerId, String screenName) { 
    Tracker tracker = getTracker(trackerId); 
    tracker.setScreenName(screenName); 
    tracker.send(new HitBuilders.ScreenViewBuilder().setNewSession().build()); 
} 

GoogleAnalyticsTracker.js並添加

createNewSession(screenName) { 
    GoogleAnalyticsBridge.createNewSession(this.id, screenName); 

}

GoogleAnalyticsBackwardsCompatibility.js並添加 createNewSession(screenName) { this.tracker.createNewSession(screenName); }

RCTGoogleAnalyticsBridge.m(只增加了IOS簽名),並添加 RCT_EXPORT_METHOD(createNewSession:(NSString *)trackerId screenName:(NSString *)screenName) { }

裏面去反應母語 - 谷歌 - 分析橋/ android文件夾,和清潔利用「./gradlew乾淨的命令」

然後從react-native-google-analytics-bridge文件夾構建,使用「npm run start」進行的更改

相關問題