What is a talkingData

TalkingData App Analytics was launched in February 2012 and released in May 2012. It is a set of data statistics and analysis platform for mobile applications, aiming to solve the daily application operation data needs such as mobile application data statistics and channel evaluation. Jumei Youpin, Didi Taxi, Qunar, E and other companies are using App Analytics. The main advantages of App Analytics are as follows:

  • Build a sound user analysis system: accurately identify the number and proportion of user imports in sub-channels, and provide real-time data feedback, so that mobile developers can understand the data changes in the first time and respond quickly.

  • Carry out fine data operation: use the funnel model, multi-dimensional drilling and other tools to truly put the fine operation into practice.

  • Improve productivity: Make mobile developers more productive with easy data comparison, automated alerts, channel packaging tools, and more.

To understand the background

Project number due to the use of more and more, and more people also (helpless pain programmers) more bugs, PM urgently need a can analyze the user habit, analysis of error reporting Log, the situation of the original project USES is the foundation to background to generate a Log file to call Log mode, but the limitation is very high, and it is used to analyze the user’s error conditions, There is no analysis of users’ usage scenarios and habits. After consulting colleagues in the wireless department, I know TalkingData


Start with native encapsulation

The android

    import com.tendcloud.tenddata.TCAgent;
    public void addTalkingData(String EVENT_ID, String EVENT_LABEL, ReadableMap map) {

        Map<String, Object> newMap = new HashMap();

        ReadableMapKeySetIterator iterator = map.keySetIterator();
        while (iterator.hasNextKey()) {
            String key = iterator.nextKey();
            switch (map.getType(key)) {
                case Null:
                    newMap.put(key, JSONObject.NULL);
                case Boolean:
                    newMap.put(key, map.getBoolean(key));
                case Number:
                    newMap.put(key, map.getDouble(key));
                case String:
                    newMap.put(key, map.getString(key));
        TCAgent.onEvent(reactContext, EVENT_ID, EVENT_LABEL, newMap);


RCT_EXPORT_METHOD(addTalkingData:(NSString *)eventName andLableName:(NSString *)lblName andDic:(NSDictionary *)dic){ [TalkingData trackEvent:eventName label:lblName parameters:dic]; } RCT_EXPORT_METHOD(addLog:(NSString *)eventName andDic:(NSDictionary *)dic){ NSMutableDictionary *mutable = [[NSMutableDictionary alloc] init]; NSString *str = @""; if(dic[@"Date"]! =nil){ str = [NSString stringWithFormat:@"%@%@,",str,dic[@"Date"]]; } if(dic[@"IsSuccess"]! =nil){ str = [NSString stringWithFormat:@"%@%@,",str,dic[@"IsSuccess"]]; } if(dic[@"MemberId"]! =nil){ str = [NSString stringWithFormat:@"%@%@,",str,dic[@"MemberId"]]; } NSString *message = dic[@"Message"]; if(message! =nil){ if([message length]>50){ message = [message substringToIndex:50]; } str = [NSString stringWithFormat:@"%@%@",str,message]; } [mutable setObject:str forKey:@"InfoDetail"]; [TalkingData trackEvent:[NSString stringWithFormat:@"Log_%@",eventName] label:nil parameters:mutable]; }


Method of use is NativeModule. AddTalkingData (event, label, obj); Usually you need to bring some information with you by default, and you don’t want to declare the nativeModule everywhere, so you just open a file and use the method in other files

'use strict'; import React, { NativeModules } from 'react-native'; import { Version, } from './AppConfig'; const NativeModule = NativeModules.RNModule; Module. exports = {// exports strlen(STR){var len = 0; for (var i=0; i<str.length; i++) { var c = str.charCodeAt(i); / / single-byte add 1 if ((c > = 0 x0001 && c < = 0 x007e) | | (0 xff60 && c < = c < = 0 xff9f)) {len++; } else { len+=2; } } return len; }, TalkingData (event,label,obj){if(obj. Length > 0){for(var item in obj){if(obj[item]. Length > 64){ Obj [item] = obj[item].substring(0,60) + "..." ; } } } obj.version = Version; obj.error = obj.error.toString(); try{ obj.error = JSON.stringify(obj.error); }catch(e){ obj.error = obj.error.toString(); } obj.versionJobNumber = obj.version + '#' + (obj.employee || ''); NativeModule.addTalkingData(event,label,obj); }}

OK, so that the external file only needs to reference the talkingData file, when used


In this way, the process is finished. If you look at the data, you can go to the official website of TalkingData to view it. You can see the very awesome ah, version screening, channel screening, and so on. At the same time, if the program is wrong, you can also view it, easy to locate the wrong place. A screenshot, experience