yas_data.js 1.23 KB
/**
 * Created by qiujun on 16/7/25.
 */

var live_data_event = ['YB_ACTIVITY_PAGE_INFO', 'YB_ACTIVITY_PAGE_SHARE', 'YB_ACTIVITY_PAGE_DOWNLOAD', 'YB_ACTIVITY_PAGE_REVIEW', 'YB_ACTIVITY_PAGE_GOBUY'];
var live_data_type = ['ACT_STAGE', 'IS_APP_OPEN', 'APP_STYLE', 'TO_URL'];
var play_count = 0;

function get_yohood_data() {
    var data_event = (typeof(arguments[0]) == "undefined") ? 0 : arguments[0];
    var data_value1 = (typeof(arguments[1]) == "undefined") ? 0 : arguments[1];
    var data_value2 = (typeof(arguments[2]) == "undefined") ? 0 : arguments[2];
    var data_value3 = (typeof(arguments[3]) == "undefined") ? 0 : arguments[3];

    console.log(data_event, data_value1, data_value2, data_value3);

    if (data_event != 0) {
        var obj = {};
        var data_event_str = live_data_event[data_event - 1];
        obj.EVENT = data_event_str;
        obj.ACT_STAGE = data_value1;
        obj.IS_APP_OPEN = data_value2;
        if (data_event === 3) {
            obj.APP_STYLE = data_value3;
        }
        if (data_event === 5) {
            obj.TO_URL = data_value3;
        }
        send_data(obj);
    }

}

function send_data(obj) {
    console.log(obj);
    if (window._yas) {
        window._yas.sendCustomInfo(obj, true);
    }
}