Wiki source code of ONEcount Javascript Widgets
Version 8.1 by melanie@one-count_com on 2016/12/13 14:23
Show last authors
| author | version | line-number | content |
|---|---|---|---|
| 1 | {{layout}} | ||
| 2 | {{layout-section ac:type="two_right_sidebar"}} | ||
| 3 | {{layout-cell}} | ||
| 4 | ---- | ||
| 5 | |||
| 6 | (updated 10/12/16) | ||
| 7 | |||
| 8 | |||
| 9 | |||
| 10 | **all.min.js**: This is the main script that's used for data collection, interacting with ONEcount. | ||
| 11 | |||
| 12 | The main object in this script is called **GCN**. **GCN** contains the following objects: | ||
| 13 | |||
| 14 | (% style="margin-left: 30.0px;" %) | ||
| 15 | **variables**: this is a container for variables that may be used by others objects in GCN | ||
| 16 | \\ | ||
| 17 | |||
| 18 | (% style="margin-left: 30.0px;" %) | ||
| 19 | **cookie**: utility for interacting with cookies. Contains the following functions: | ||
| 20 | |||
| 21 | * ((( | ||
| 22 | * ((( | ||
| 23 | **read**(**name**) : returns the value of cookie **name** or null if it doesn't exist | ||
| 24 | ))) | ||
| 25 | * ((( | ||
| 26 | **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 | ||
| 27 | ))) | ||
| 28 | * ((( | ||
| 29 | **remove**(**name**, **options**): removes the cookie **name**. **options** is an object which can have the property **sublevel | ||
| 30 | \\** | ||
| 31 | ))) | ||
| 32 | ))) | ||
| 33 | |||
| 34 | (% style="margin-left: 30.0px;" %) | ||
| 35 | **url**: utility for interacting with url. Contains the following functions: | ||
| 36 | |||
| 37 | * ((( | ||
| 38 | * ((( | ||
| 39 | **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** | ||
| 40 | ))) | ||
| 41 | * ((( | ||
| 42 | **params**(**url**): return a key value pair object of the query string parameters | ||
| 43 | ))) | ||
| 44 | ))) | ||
| 45 | |||
| 46 | * ((( | ||
| 47 | * ((( | ||
| 48 | **build**(**url**, **params**): create a new **url** based of the provided **url** and **params** | ||
| 49 | ))) | ||
| 50 | ))) | ||
| 51 | |||
| 52 | |||
| 53 | |||
| 54 | (% style="margin-left: 30.0px;" %) | ||
| 55 | **script**: utility for interacting with scripts. Contains the following functions: | ||
| 56 | |||
| 57 | * ((( | ||
| 58 | * ((( | ||
| 59 | **add**(**url**): creates a script tag using **document.write** whose **src** is **url** | ||
| 60 | ))) | ||
| 61 | * ((( | ||
| 62 | **addInHeader**(**url**): create a script tag in the **head** whose **src** is **url** | ||
| 63 | ))) | ||
| 64 | * ((( | ||
| 65 | **addAsync**(**url**): create a script tag in the **body** whose **src** is **url** | ||
| 66 | ))) | ||
| 67 | * ((( | ||
| 68 | **createScript**(**url**): helper function that create a script element whose src is url\\ | ||
| 69 | ))) | ||
| 70 | ))) | ||
| 71 | |||
| 72 | (% style="margin-left: 30.0px;" %) | ||
| 73 | **method**: utility for dynamically invoking methods. Contains the following functions: | ||
| 74 | |||
| 75 | * ((( | ||
| 76 | * ((( | ||
| 77 | **call**(**f**, **options**): calls the function **f | ||
| 78 | \\** | ||
| 79 | ))) | ||
| 80 | ))) | ||
| 81 | |||
| 82 | (% style="margin-left: 30.0px;" %) | ||
| 83 | **event**: utility for interacting with event. Contains the following functions: | ||
| 84 | |||
| 85 | * ((( | ||
| 86 | * ((( | ||
| 87 | **on**(type, listener, f) : add a listener that executes the function **f** when event of type **type** occurs on **listener** | ||
| 88 | ))) | ||
| 89 | * ((( | ||
| 90 | **off**(**type**, **listener**, **f**): removes the listener that executes the function **f** when event of type **type** occurs | ||
| 91 | \\ | ||
| 92 | ))) | ||
| 93 | ))) | ||
| 94 | |||
| 95 | (% style="margin-left: 30.0px;" %) | ||
| 96 | **random**: utility for generating random number and string. Contains the following functions: | ||
| 97 | |||
| 98 | * ((( | ||
| 99 | * ((( | ||
| 100 | **number**(): return a random integer | ||
| 101 | ))) | ||
| 102 | * ((( | ||
| 103 | **string**(**count**): return a random string of length **count** | ||
| 104 | \\ | ||
| 105 | ))) | ||
| 106 | ))) | ||
| 107 | |||
| 108 | (% style="margin-left: 30.0px;" %) | ||
| 109 | **tracker**: this is used for tracking web impressions. Contains many functions used internally but the 2 functions accessible publicly are: | ||
| 110 | |||
| 111 | * ((( | ||
| 112 | * ((( | ||
| 113 | **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 ? | ||
| 114 | ))) | ||
| 115 | * ((( | ||
| 116 | **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**. | ||
| 117 | \\ | ||
| 118 | ))) | ||
| 119 | ))) | ||
| 120 | |||
| 121 | (% style="margin-left: 30.0px;" %) | ||
| 122 | **ONEcount**: object for interacting with ONEcount application. This object contains many functions and objects. | ||
| 123 | |||
| 124 | (% style="margin-left: 60.0px;" %) | ||
| 125 | a.** Functions**: | ||
| 126 | |||
| 127 | * ((( | ||
| 128 | * ((( | ||
| 129 | **init**(): initialize the widget | ||
| 130 | ))) | ||
| 131 | * ((( | ||
| 132 | **parseScript**(): parse the main script that was loaded to retrieve the **clientId** | ||
| 133 | ))) | ||
| 134 | * ((( | ||
| 135 | **getClientId**(): return the **clientId** | ||
| 136 | ))) | ||
| 137 | * ((( | ||
| 138 | **getOrigin**(): returns the script's **origin** | ||
| 139 | ))) | ||
| 140 | * ((( | ||
| 141 | **getScript**(): return the current script that is being executed | ||
| 142 | ))) | ||
| 143 | * ((( | ||
| 144 | **setUrls**(): set the different urls endpoint (**automation**, **login/logout**, **tracking**, **viewability**, **form embed**, ...) used to interact with ONEcount | ||
| 145 | ))) | ||
| 146 | * ((( | ||
| 147 | **setLinks**(): set the login/logout url as link. | ||
| 148 | ))) | ||
| 149 | * ((( | ||
| 150 | **setTargeting**() : loads the automation script used for **targeting** | ||
| 151 | ))) | ||
| 152 | * ((( | ||
| 153 | **loadAdditionalScripts**(): load additional scripts based on the **clientId** | ||
| 154 | ))) | ||
| 155 | * ((( | ||
| 156 | **isLoggedIn**(): return true if the user is logged in | ||
| 157 | ))) | ||
| 158 | * ((( | ||
| 159 | **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 | ||
| 160 | ))) | ||
| 161 | * ((( | ||
| 162 | **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. | ||
| 163 | ))) | ||
| 164 | ))) | ||
| 165 | |||
| 166 | |||
| 167 | |||
| 168 | (% style="margin-left: 60.0px;" %) | ||
| 169 | b. ** Objects** | ||
| 170 | |||
| 171 | * ((( | ||
| 172 | * ((( | ||
| 173 | **urls**: this object contains all the url used to interact with ONEcount. These url already have the **clientId** appended to them. | ||
| 174 | \\ | ||
| 175 | ))) | ||
| 176 | * ((( | ||
| 177 | **links:** this object contains links to the login/logout in ONEcount. Below are the functions: | ||
| 178 | ))) | ||
| 179 | ))) | ||
| 180 | |||
| 181 | * ((( | ||
| 182 | * ((( | ||
| 183 | * ((( | ||
| 184 | **login**() : return the link needed for login | ||
| 185 | ))) | ||
| 186 | * ((( | ||
| 187 | **logout**(): return the link need for logout | ||
| 188 | ))) | ||
| 189 | * ((( | ||
| 190 | This also contains other helper functions such as **setReturn**(**returnUrl**), **getReturnParam**(**returnUrl**), **encodeUrl**(**url**), **decodeUrl**(**url**) | ||
| 191 | \\ | ||
| 192 | ))) | ||
| 193 | ))) | ||
| 194 | ))) | ||
| 195 | |||
| 196 | * ((( | ||
| 197 | * ((( | ||
| 198 | **modal**: used to create a modal. This is being used for the form popup and the custom targeting pop up Contains the following functions: | ||
| 199 | |||
| 200 | * | ||
| 201 | |||
| 202 | **create**(**options**): create a modal. options is an object that contains the properties **html**, **styles**, **close** | ||
| 203 | |||
| 204 | * | ||
| 205 | |||
| 206 | **getCloseButton**(**options**): return the close button element. **options** is an object that contains the properties **close** | ||
| 207 | |||
| 208 | * | ||
| 209 | |||
| 210 | **getContent**(**options**): return a div that contains the content of the modal. **options** is an object that contains the properties **html** | ||
| 211 | |||
| 212 | * | ||
| 213 | |||
| 214 | **loadStyles**(**options**): load css styles used for the modal. **options** is an object that contains the properties **style | ||
| 215 | \\** | ||
| 216 | ))) | ||
| 217 | * ((( | ||
| 218 | **functions**: this is an object contains functions used by other widgets on the page. Contains the following functions: | ||
| 219 | |||
| 220 | * | ||
| 221 | |||
| 222 | **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**) | ||
| 223 | |||
| 224 | * | ||
| 225 | |||
| 226 | **get_user_data()**: returns the user's **ocid** and **tempid** in the format **ocid.tempid | ||
| 227 | \\** | ||
| 228 | ))) | ||
| 229 | * ((( | ||
| 230 | **form**: used to create a pop up form or for form embed. Contains one function and another object: | ||
| 231 | |||
| 232 | * | ||
| 233 | |||
| 234 | **embed**(**options**): this function is used to embed a form on the page | ||
| 235 | |||
| 236 | * | ||
| 237 | |||
| 238 | **popup:** this object is used to display the form as a popup. Contains the following functions: | ||
| 239 | |||
| 240 | * | ||
| 241 | |||
| 242 | **resize**(**id**): re sizes the form with document id **id** | ||
| 243 | |||
| 244 | * | ||
| 245 | |||
| 246 | **display**(options): displays the form as a pop up | ||
| 247 | |||
| 248 | * | ||
| 249 | |||
| 250 | **message**(event): used to interact with the form in the iframe via **postMessage** | ||
| 251 | ))) | ||
| 252 | ))) | ||
| 253 | |||
| 254 | |||
| 255 | |||
| 256 | 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. | ||
| 257 | |||
| 258 | **v.js:** This script is used to capture viewability data for **DFP Premium** and **Openx Open Source (Revive)**. | ||
| 259 | |||
| 260 | **v_sb.js:** This script is used to capture viewability data for **DFP Small Business** | ||
| 261 | |||
| 262 | **fs.js:** This is the form scrapper script. Used to scrapped content from 3^^rd^^ party forms when they are being submitted. | ||
| 263 | |||
| 264 | |||
| 265 | |||
| 266 | \\ | ||
| 267 | |||
| 268 | |||
| 269 | |||
| 270 | \\ | ||
| 271 | {{/layout-cell}} | ||
| 272 | |||
| 273 | {{layout-cell}} | ||
| 274 | {{panel borderStyle="solid" title="Search all Documentation:"}} | ||
| 275 | |||
| 276 | |||
| 277 | {{livesearch/}} | ||
| 278 | {{/panel}} | ||
| 279 | |||
| 280 | {{panel borderStyle="solid" title=" Search System and Setup Information:"}} | ||
| 281 | |||
| 282 | |||
| 283 | {{pagetreesearch rootPage="System and Setup Information"/}} | ||
| 284 | {{/panel}} | ||
| 285 | |||
| 286 | {{panel borderStyle="solid" title="More System and Setup Information"}} | ||
| 287 | {{expand}} | ||
| 288 | [[ONEcount Cookies>>url:http://bos-jira01-cl01.onecount.net:8090/pages/viewpage.action?pageId=65727||shape="rect"]] | ||
| 289 | \\[[Widget Implementation>>url:http://bos-jira01-cl01.onecount.net:8090/pages/viewpage.action?pageId=65622||shape="rect"]] | ||
| 290 | \\[[Widget Builder>>url:http://bos-jira01-cl01.onecount.net:8090/pages/viewpage.action?pageId=65735||shape="rect"]] | ||
| 291 | \\[[\\\\ONEcount Javascript Widget Changes>>url:http://bos-jira01-cl01.onecount.net:8090/pages/viewpage.action?pageId=65751||shape="rect"]][[ | ||
| 292 | \\>>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"]][[ | ||
| 293 | \\>>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"]][[ | ||
| 294 | >>url:http://bos-jira01-cl01.onecount.net:8090/pages/viewpage.action?pageId=65735||shape="rect"]][[ | ||
| 295 | 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"]][[ | ||
| 296 | \\>>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"]][[ | ||
| 297 | \\>>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"]][[ | ||
| 298 | \\>>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"]][[ | ||
| 299 | \\>>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"]][[ | ||
| 300 | \\>>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"]][[ | ||
| 301 | \\>>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"]][[ | ||
| 302 | >>url:http://bos-jira01-cl01.onecount.net:8090/pages/viewpage.action?pageId=65735||shape="rect"]][[ | ||
| 303 | Email Engine and Sender Score>>url:http://bos-jira01-cl01.onecount.net:8090/display/OD/Email+Engine+and+Sender+Score||shape="rect"]][[ | ||
| 304 | \\>>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"]][[ | ||
| 305 | >>url:http://bos-jira01-cl01.onecount.net:8090/pages/viewpage.action?pageId=65735||shape="rect"]][[ | ||
| 306 | >>url:http://bos-jira01-cl01.onecount.net:8090/pages/viewpage.action?pageId=65751||shape="rect"]][[ | ||
| 307 | >>url:http://bos-jira01-cl01.onecount.net:8090/pages/viewpage.action?pageId=65751||shape="rect"]] | ||
| 308 | {{/expand}} | ||
| 309 | {{/panel}} | ||
| 310 | |||
| 311 | |||
| 312 | |||
| 313 | |||
| 314 | |||
| 315 | |||
| 316 | {{/layout-cell}} | ||
| 317 | {{/layout-section}} | ||
| 318 | {{/layout}} |