-
Notifications
You must be signed in to change notification settings - Fork 0
/
custom.html
117 lines (117 loc) · 3.91 KB
/
custom.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta name="applicable-device" content="mobile"/>
<meta name="viewport" content="width=device-width,initial-scale=1.0,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no"/>
<meta content="telephone=no" name="format-detection"/>
<meta content="black" name="apple-mobile-web-app-status-bar-style">
<meta content="yes" name="apple-mobile-web-app-capable"/>
<meta http-equiv="Cache-Control" content="no-transform"/>
<meta http-equiv="Cache-Control" content="no-siteapp"/>
<title>TalkingData Custom</title>
<link rel="stylesheet" href="css/public_head.css" />
<link rel="stylesheet" href="css/public_body.css" />
<script type="text/javascript" src="js/jquery.js"></script>
<script type="text/javascript" src="js/phone.js" ></script>
<script type="text/javascript" src="js/TalkingDataSDK.js"></script>
</head>
<body>
<div class="head_line">
<p class="head_line_p">
TalkingDataSDK
</p>
</div>
<div class="new_index">
<div class="wd_title">
<img src="images/custom.png">自定义事件
</div>
<div class="wd_index">
<div class="wd_line">
<span>代码事件ID</span>
<input id="tx_id" type="text" class="line_input" placeholder="Event ID">
</div>
<div class="wd_line">
<span>事件参数</span>
<input id="tx_key1" type="text" class="line_input" placeholder="key1">
</div>
<div class="wd_line">
<input id="tx_value1" type="text" class="line_input" placeholder="key1对应的value">
</div>
<div class="wd_line">
<input id="tx_key2" type="text" class="line_input" placeholder="key2">
</div>
<div class="wd_line">
<input id="tx_value2" type="text" class="line_input" placeholder="key2对应的value">
</div>
<div class="btn_line">
<input id="btn_event" type="button" class="bottom_btn" value="提交事件数据">
</div>
</div>
</div>
<div class="new_index">
<div class="wd_title">
<img src="images/custom.png">全局参数
</div>
<div class="wd_index">
<div class="wd_line">
<span>参数Key</span>
<input id="tx_key" type="text" class="line_input" placeholder="key">
</div>
<div class="wd_line">
<span>参数Value</span>
<input id="tx_value" type="text" class="line_input" placeholder="value">
</div>
<div class="btn_line">
<input id="btn_set" type="button" class="bottom_btn" value="设置全局参数">
</div>
<div class="btn_line">
<input id="btn_remove" type="button" class="bottom_btn" value="删除全局参数">
</div>
</div>
</div>
<div class="new_index">
<div class="wd_title">
</div>
<div class="btn_line">
<input id="btn_back" type="button" class="bottom_btn" value="返回">
</div>
</div>
<script src="cordova.js"></script>
<script>
$('#btn_event').on('click', function(){
var eventId = $('#tx_id').val();
var dataKey1 = $('#tx_key1').val();
var dataValue1 = $('#tx_value1').val();
var dataKey2 = $('#tx_key2').val();
var dataValue2 = $('#tx_value2').val();
if (!eventId || eventId == "") {
return;
}
var eventData = {};
if (dataKey1.length > 0 && dataValue1.length > 0) {
eventData[dataKey1] = dataValue1;
}
if (dataKey2.length > 0 && dataValue2.length > 0) {
eventData[dataKey2] = dataValue2;
}
var eventValue = {
key : "value"
};
TalkingDataSDK.onEvent(eventId, eventData, eventValue);
});
$('#btn_set').on("click", function(){
var key = $('#tx_key').val();
var value = $('#tx_value').val();
TalkingDataSDK.setGlobalKV(key, value);
});
$('#btn_remove').on("click", function(){
var key = $('#tx_key').val();
TalkingDataSDK.removeGlobalKV(key);
});
$('#btn_back').on("click", function(){
window.history.back();
});
</script>
</body>
</html>