This repository was archived by the owner on Aug 21, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathindex.html
More file actions
225 lines (195 loc) · 6.12 KB
/
index.html
File metadata and controls
225 lines (195 loc) · 6.12 KB
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
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
<!DOCTYPE html>
<html>
<head>
<title>Octo Javascript Client</title>
<!-- Bootstrap minified CSS -->
<link rel="stylesheet" href="libs/bootstrapv3/css/bootstrap.min.css">
<!-- Bootstrap minified Optional theme -->
<link rel="stylesheet" href="libs/bootstrapv3/css/bootstrap-theme.min.css">
</head>
<body>
<div class="container">
<div class="row">
<div class="title">
<h2>Octo Javascript Client</h2>
</div>
</div>
<div class="row">
<button class="btn btn-primary" onclick="initCall()">
App Init
</button>
<button class="btn btn-primary" onclick="loginCall()">
App Login
</button>
<button class="btn btn-primary" onclick="logoutCall()">
App Logout
</button>
<button class="btn btn-primary" onclick="$.octo.pageView">
App Pageview
</button>
<button class="btn btn-primary" onclick="productviewCall()">
App Product Pageview
</button>
<button class="btn btn-primary" onclick="updateProfile()">
Update Profile
</button>
<button class="btn btn-primary" onclick="addProduct()">
Add Product
</button>
</div>
<div class="row">
<h4>Request JSON</h4>
<div class="jsonTag">
<!-- Dummy JSON goes here -->
<pre></pre>
</div>
</div>
<div class="row">
<h4>Response JSON</h4>
<div class="response">
<!-- Response JSON -->
<pre></pre>
</div>
</div>
</div>
<!-- Include Jquery -->
<script src="libs/jquery/jquery-1.11.1.min.js"></script>
<!-- Include cookie.js -->
<script type="text/javascript" src="libs/jquery.cookie.js"></script>
<!-- Bootstrap minified JavaScript -->
<script src="libs/bootstrapv3/js/bootstrap.min.js"></script>
<script type="text/javascript" src="libs/octo.js"></script>
<script type="text/javascript">
// Javascript Goes here
var baseUrl = "http://127.0.0.1:8000";
var API_KEY = "2cf4edcc20ca2cc4ff1f7e29779c8dc6";
var initUrl = baseUrl.concat("/events/app.init/");
var loginUrl = baseUrl.concat("/events/app.login/");
var logoutUrl = baseUrl.concat("/events/app.logout/");
var pageUrl = baseUrl.concat("/events/page.view/");
var productUrl = baseUrl.concat("/events/productpage.view/");
var profileUrl = baseUrl.concat("/update_profile/");
var addProductUrl = baseUrl.concat("/product/");
var customEventUrl = baseUrl.concat("/custom/banner_ad/")
function initCall(){
$('.jsonTag').html("<pre>" + JSON.stringify(json_data_common, undefined, 2) + "</pre>");
$.octo.ajax(initUrl, json_data_common, {apikey: API_KEY});
}
function loginCall(){
$('.jsonTag').html("<pre>" + JSON.stringify(json_data_common, undefined, 2) + "</pre>");
$.octo.ajax(loginUrl, json_data_common, {apikey: API_KEY});
}
function logoutCall(){
$('.jsonTag').html("<pre>" + JSON.stringify(json_data_common, undefined, 2) + "</pre>");
$.octo.ajax(logoutUrl, json_data_common, {apikey: API_KEY});
}
function pageviewCall(){
$('.jsonTag').html("<pre>" + JSON.stringify(json_data_page, undefined, 2) + "</pre>");
$.octo.ajax(pageUrl, json_data_page, {apikey: API_KEY});
}
function productviewCall(){
$('.jsonTag').html("<pre>" + JSON.stringify(json_data_product, undefined, 2) + "</pre>");
$.octo.ajax(productUrl, json_data_product, {apikey: API_KEY});
}
function updateProfile(){
$('.jsonTag').html("<pre>" + JSON.stringify(json_data_profile, undefined, 2) + "</pre>");
$.octo.ajax(profileUrl, json_data_profile, {apikey: API_KEY});
}
function addProduct(){
$('.jsonTag').html("<pre>" + JSON.stringify(json_add_product, undefined, 2) + "</pre>");
$.octo.ajax(addProductUrl, json_add_product, {apikey: API_KEY});
}
function customEvent(){
$('.jsonTag').html("<pre>" + JSON.stringify(json_custom_data, undefined, 2) + "</pre>");
$.octo.ajax(customEventUrl, json_custom_data, {apikey: API_KEY});
}
// Ajax callback function
function onSuccess(data) {
console.log(data);
$('.response').html("<pre>" + JSON.stringify(data, undefined, 2) + "</pre>");
}
// Ajax callback function
function onError(data) {
$('.response').html("<pre>" + JSON.stringify(data.responseJSON, undefined, 2) + "</pre>");
}
var browser_details_json = {
name: $.octo.browser_name(),
platform: navigator.platform,
manufacturer: navigator.vendor,
};
var json_data_common = {
userId: 123456789,
browserDetails: browser_details_json
};
var json_data_page = {
userId: 123456789,
browserDetails: browser_details_json,
routeUrl: "/Home/DealsOfTheDay/34",
categories: [
"shopping"
],
tags: [
"handbags",
"aldo",
"yellow"
]
};
var json_data_product = {
userId: 123456789,
browserDetails: browser_details_json,
routeUrl: "/Home/DealsOfTheDay/23",
categories: [
"shopping"
],
tags: [
"handbags",
"aldo",
"yellow"
],
productId: 63725,
productName: "Smartphone Series S01",
price: 99.99
};
var json_data_profile = {
userId: 123456789,
browserDetails: browser_details_json,
profileDetails: {
email: 'ravingupta129@gmail.com',
username: 'username',
gender: 'Male',
dob: '321ded12dw1d2s1',
alternate_email: '',
mobile: '123467890',
extras: ''
}
};
var json_add_product = {
routeUrl: "/Home/DealsOfTheDay/23",
categories: [
"shopping"
],
tags: [
"handbags",
"aldo",
"yellow"
],
productId: 63725,
productName: "Smartphone Series S01",
price: 99.99
};
var json_custom_data = {
routeUrl: "/Home/adv",
userId: 123456789,
browserDetails: browser_details_json,
advertisement_id: "123abc",
advertisement_tags: [
"banner",
"product"
]
}
$.octo.apikey = API_KEY;
$.octo.init({
});
</script>
</body>
</html>