Wiki source code of ONEcount Javascript Widgets

Version 5.1 by melanie@one-count_com on 2016/11/17 13:44

Hide last authors
melanie@one-count_com 1.1 1 {{layout}}
2 {{layout-section ac:type="two_right_sidebar"}}
3 {{layout-cell}}
4 (updated 10/12/16)
5
6
7
8 **all.min.js**: This is the main script that's used for data collection, interacting with ONEcount.
9
10 The main object in this script is called **GCN**. **GCN** contains the following objects:
11
12 (% style="margin-left: 30.0px;" %)
13 **variables**: this is a container for variables that may be used by others objects in GCN
14 \\
15
16 (% style="margin-left: 30.0px;" %)
17 **cookie**: utility for interacting with cookies. Contains the following functions:
18
19 * (((
20 * (((
21 **read**(**name**) : returns the value of cookie **name** or null if it doesn't exist
22 )))
23 * (((
24 **set**(**name**, **value**, **options**): create a cookie called **name** with value **value**. **options** is an object which can have **expires**, **path**, **domain** and **secure** properties
25 )))
26 * (((
27 **remove**(**name**, **options**): removes the cookie **name**. **options** is an object which can have the property **sublevel
28 \\**
29 )))
30 )))
31
32 (% style="margin-left: 30.0px;" %)
33 **url**: utility for interacting with url. Contains the following functions:
34
35 * (((
36 * (((
37 **parse**(**url**): parses the url and returns an object containing these properties : **href**, **withoutHash**, **url**, **origin**, **protocol**, **protocolseparator**, **credhost**, **cred**, **user**, **pass**, **host**, **hostname**, **port**, **pathname**, **segment1**, **segment2**, **search**, **hash**
38 )))
39 * (((
40 **params**(**url**): return a key value pair object of the query string parameters
41 )))
42 )))
43
44 * (((
45 * (((
46 **build**(**url**, **params**): create a new **url** based of the provided **url** and **params**
47 )))
48 )))
49
50
51
52 (% style="margin-left: 30.0px;" %)
53 **script**: utility for interacting with scripts. Contains the following functions:
54
55 * (((
56 * (((
57 **add**(**url**): creates a script tag using **document.write** whose **src** is **url**
58 )))
59 * (((
60 **addInHeader**(**url**): create a script tag in the **head** whose **src** is **url**
61 )))
62 * (((
63 **addAsync**(**url**): create a script tag in the **body** whose **src** is **url**
64 )))
65 * (((
66 **createScript**(**url**): helper function that create a script element whose src is url\\
67 )))
68 )))
69
70 (% style="margin-left: 30.0px;" %)
71 **method**: utility for dynamically invoking methods. Contains the following functions:
72
73 * (((
74 * (((
75 **call**(**f**, **options**): calls the function **f
76 \\**
77 )))
78 )))
79
80 (% style="margin-left: 30.0px;" %)
81 **event**: utility for interacting with event. Contains the following functions:
82
83 * (((
84 * (((
85 **on**(type, listener, f) : add a listener that executes the function **f** when event of type **type** occurs on **listener**
86 )))
87 * (((
88 **off**(**type**, **listener**, **f**): removes the listener that executes the function **f** when event of type **type** occurs
89 \\
90 )))
91 )))
92
93 (% style="margin-left: 30.0px;" %)
94 **random**: utility for generating random number and string. Contains the following functions:
95
96 * (((
97 * (((
98 **number**(): return a random integer
99 )))
100 * (((
101 **string**(**count**): return a random string of length **count**
102 \\
103 )))
104 )))
105
106 (% style="margin-left: 30.0px;" %)
107 **tracker**: this is used for tracking web impressions. Contains many functions used internally but the 2 functions accessible publicly are:
108
109 * (((
110 * (((
111 **init**(**_gcnt**): called on page load to initialize the tracker which which will start collecting impressions. **_gcnt** is an array that contains options used by the tracker.~/~/add list of options ?
112 )))
113 * (((
114 **track**(**url**, **title**, **referer**): used to dynamically track a page with url **url**, title **title** and referer **referer**. This can be used with **infinite scroll**.
115 \\
116 )))
117 )))
118
119 (% style="margin-left: 30.0px;" %)
120 **ONEcount**: object for interacting with ONEcount application. This object contains many functions and objects.
121
122 (% style="margin-left: 60.0px;" %)
123 a.** Functions**:
124
125 * (((
126 * (((
127 **init**(): initialize the widget
128 )))
129 * (((
130 **parseScript**(): parse the main script that was loaded to retrieve the **clientId**
131 )))
132 * (((
133 **getClientId**(): return the **clientId**
134 )))
135 * (((
136 **getOrigin**(): returns the script's **origin**
137 )))
138 * (((
139 **getScript**(): return the current script that is being executed
140 )))
141 * (((
142 **setUrls**(): set the different urls endpoint (**automation**, **login/logout**, **tracking**, **viewability**, **form embed**, ...) used to interact with ONEcount
143 )))
144 * (((
145 **setLinks**(): set the login/logout url as link.
146 )))
147 * (((
148 **setTargeting**() : loads the automation script used for **targeting**
149 )))
150 * (((
151 **loadAdditionalScripts**(): load additional scripts based on the **clientId**
152 )))
153 * (((
154 **isLoggedIn**(): return true if the user is logged in
155 )))
156 * (((
157 **checkPerm**(**params**): makes a **jsonp** request to the perm server to check whether the user has access to the page or not. **params** is an object that can have **url**, **referrer**, **resource** properties. If **url** and **referrer** are not provided, they will be retrieved from the window element. This is actually calling **tracker.track(url, title, referer)**. If the callback is provided, it will be called once a response is received from the server. This is being used to return the number of articles read for windowed products
158 )))
159 * (((
160 **gate**(**resource**): makes a **jsonp** request to the perm server to take the user to the registration page for resource. If the user is already subscribed then nothing will happen.
161 )))
162 )))
163
164
165
166 (% style="margin-left: 60.0px;" %)
167 b. ** Objects**
168
169 * (((
170 * (((
171 **urls**: this object contains all the url used to interact with ONEcount. These url already have the **clientId** appended to them.
172 \\
173 )))
174 * (((
175 **links:** this object contains links to the login/logout in ONEcount. Below are the functions:
176 )))
177 )))
178
179 * (((
180 * (((
181 * (((
182 **login**() : return the link needed for login
183 )))
184 * (((
185 **logout**(): return the link need for logout
186 )))
187 * (((
188 This also contains other helper functions such as **setReturn**(**returnUrl**), **getReturnParam**(**returnUrl**), **encodeUrl**(**url**), **decodeUrl**(**url**)
189 \\
190 )))
191 )))
192 )))
193
194 * (((
195 * (((
196 **modal**: used to create a modal. This is being used for the form popup and the custom targeting pop up Contains the following functions:
197
198 *
199
200 **create**(**options**): create a modal. options is an object that contains the properties **html**, **styles**, **close**
201
202 *
203
204 **getCloseButton**(**options**): return the close button element. **options** is an object that contains the properties **close**
205
206 *
207
208 **getContent**(**options**): return a div that contains the content of the modal. **options** is an object that contains the properties **html**
209
210 *
211
212 **loadStyles**(**options**): load css styles used for the modal. **options** is an object that contains the properties **style
213 \\**
214 )))
215 * (((
216 **functions**: this is an object contains functions used by other widgets on the page. Contains the following functions:
217
218 *
219
220 **dfp_sb_ad_capture**(**e**): used to prepare data for **DFP Small Business** viewability script. e is and event containing data about the data (**creativeId**, **lineItemId**)
221
222 *
223
224 **get_user_data()**: returns the user's **ocid** and **tempid** in the format **ocid.tempid
225 \\**
226 )))
227 * (((
228 **form**: used to create a pop up form or for form embed. Contains one function and another object:
229
230 *
231
232 **embed**(**options**): this function is used to embed a form on the page
233
234 *
235
236 **popup:** this object is used to display the form as a popup. Contains the following functions:
237
238 *
239
240 **resize**(**id**): re sizes the form with document id **id**
241
242 *
243
244 **display**(options): displays the form as a pop up
245
246 *
247
248 **message**(event): used to interact with the form in the iframe via **postMessage**
249 )))
250 )))
251
252
253
254 On top of this **all.min.js** also contains a library used for browser fingerprinting as well as a library used for getting flash info on the browser. The content of this files used to spread in 3 different files and now they're in one place.
255
256 **v.js:** This script is used to capture viewability data for **DFP Premium** and **Openx Open Source (Revive)**.
257
258 **v_sb.js:** This script is used to capture viewability data for **DFP Small Business**
259
260 **fs.js:** This is the form scrapper script. Used to scrapped content from 3^^rd^^ party forms when they are being submitted.
261
262
263
264 \\
265
266
267
268 \\
269 {{/layout-cell}}
270
271 {{layout-cell}}
melanie@one-count_com 3.1 272
273
274 {{livesearch/}}
275
melanie@one-count_com 5.1 276
277
278
279
melanie@one-count_com 4.1 280 {{expand title="More System and Setup Information"}}
281 (% style="margin-left: 30.0px;" %)
282 [[ONEcount Cookies>>url:http://bos-jira01-cl01.onecount.net:8090/pages/viewpage.action?pageId=65727||shape="rect"]]
283 \\[[Widget Implementation>>url:http://bos-jira01-cl01.onecount.net:8090/pages/viewpage.action?pageId=65622||shape="rect"]]
284 \\[[Widget Builder>>url:http://bos-jira01-cl01.onecount.net:8090/pages/viewpage.action?pageId=65735||shape="rect"]]
285
286 (% style="margin-left: 30.0px;" %)
287 [[ONEcount Javascript Widget Changes>>url:http://bos-jira01-cl01.onecount.net:8090/pages/viewpage.action?pageId=65751||shape="rect"]][[
288 \\>>url:http://bos-jira01-cl01.onecount.net:8090/pages/viewpage.action?pageId=65735||shape="rect"]][[Configuration Manager>>url:http://bos-jira01-cl01.onecount.net:8090/pages/viewpage.action?pageId=65754||shape="rect"]][[
289 \\>>url:http://bos-jira01-cl01.onecount.net:8090/pages/viewpage.action?pageId=65735||shape="rect"]][[Smartlinks, Brand Codes, and Other Form Linkouts>>url:http://bos-jira01-cl01.onecount.net:8090/pages/viewpage.action?pageId=65829||shape="rect"]][[
290 >>url:http://bos-jira01-cl01.onecount.net:8090/pages/viewpage.action?pageId=65735||shape="rect"]][[
291 ONEcount SSL and non-SSL Client Brand Pages>>url:http://bos-jira01-cl01.onecount.net:8090/display/OD/ONEcount+SSL+and+non-SSL+Client+Brand+Pages||shape="rect"]][[
292 \\>>url:http://bos-jira01-cl01.onecount.net:8090/pages/viewpage.action?pageId=65735||shape="rect"]][[OpenX Zone Setup for Banner Tracking and Viewability>>url:http://bos-jira01-cl01.onecount.net:8090/display/OD/OpenX+Zone+Setup+for+Banner+Tracking+and+Viewability||shape="rect"]][[
293 \\>>url:http://bos-jira01-cl01.onecount.net:8090/pages/viewpage.action?pageId=65735||shape="rect"]][[DFP Small Business – Create Key/Value Pair for Ad Targeting>>url:http://bos-jira01-cl01.onecount.net:8090/pages/viewpage.action?pageId=65873||shape="rect"]][[
294 \\>>url:http://bos-jira01-cl01.onecount.net:8090/pages/viewpage.action?pageId=65735||shape="rect"]][[DFP Premium – Create Key/Value Pair for Ad Targeting>>url:http://bos-jira01-cl01.onecount.net:8090/pages/viewpage.action?pageId=65879||shape="rect"]][[
295 \\>>url:http://bos-jira01-cl01.onecount.net:8090/pages/viewpage.action?pageId=65735||shape="rect"]][[Progressive Lookup>>url:http://bos-jira01-cl01.onecount.net:8090/display/OD/Progressive+Lookup||shape="rect"]][[
296 \\>>url:http://bos-jira01-cl01.onecount.net:8090/pages/viewpage.action?pageId=65735||shape="rect"]][[Embedding Forms in Web Pages>>url:http://bos-jira01-cl01.onecount.net:8090/display/OD/Embedding+Forms+in+Web+Pages||shape="rect"]][[
297 \\>>url:http://bos-jira01-cl01.onecount.net:8090/pages/viewpage.action?pageId=65735||shape="rect"]][[Overriding Lookup/Login Page Settings>>url:http://bos-jira01-cl01.onecount.net:8090/pages/viewpage.action?pageId=65896||shape="rect"]][[
298 >>url:http://bos-jira01-cl01.onecount.net:8090/pages/viewpage.action?pageId=65735||shape="rect"]][[
299 Email Engine and Sender Score>>url:http://bos-jira01-cl01.onecount.net:8090/display/OD/Email+Engine+and+Sender+Score||shape="rect"]][[
300 \\>>url:http://bos-jira01-cl01.onecount.net:8090/pages/viewpage.action?pageId=65735||shape="rect"]][[Global Features>>url:http://bos-jira01-cl01.onecount.net:8090/pages/viewpage.action?pageId=65905||shape="rect"]][[
301 >>url:http://bos-jira01-cl01.onecount.net:8090/pages/viewpage.action?pageId=65735||shape="rect"]][[
302 >>url:http://bos-jira01-cl01.onecount.net:8090/pages/viewpage.action?pageId=65751||shape="rect"]]
303 {{/expand}}
melanie@one-count_com 1.1 304 {{/layout-cell}}
305 {{/layout-section}}
306 {{/layout}}