Yahoo! Web Analytics is installed by adding a JavaScript tracking code to each web page you wish to track. Yahoo! Web Analytics generates a unique JavaScript tracking code for each project (web site), which includes a project ID, which uniquely identifies your web property for the purpose of data collection. In the code sample below, the project ID is: 123456789.
|
<!-- Yahoo! Web Analytics - All rights reserved --> <script type="text/javascript" src="http://d.yimg.com/mi/ywa.js"></script> <script type="text/javascript"> /*globals YWA*/ var YWATracker = YWA.getTracker("1000123456789"); /* YWATracker.setDocumentName(""); YWATracker.setDocumentGroup(""); */ YWATracker.submit(); </script> <noscript> <div><img src="http://a.analytics.yahoo.com/p.pl?a=1000123456789&js=no" width="1" height="1" alt="" /></div> </noscript> |
Upon loading a page, the browser processes the JavaScript tracking code. That code directs the browser to retrieve a small, invisible pixel from the Yahoo! Web Analytics web server and to process the JavaScript include file. In so doing, detailed information about visitors’ activity is sent to the Yahoo! Web Analytics database, and Yahoo! Web Analytics sets (or resets) a first-party cookie in the visitors’ browsers.
The first time a visitor comes to your web site, Yahoo! Web Analytics sets a one-year, first-party, persistent cookie in their browser that includes a unique visitor ID number. During the first visit, Yahoo! Web Analytics identifies them as a first time visitor. On subsequent visits, Yahoo! Web Analytics resets the cookie life to one year beyond the date of the visit, and identifies them as a returning visitor for the duration of that visit. If Yahoo! Web Analytics is unable to set a cookie, then it will identify the visitor as a first time visitor. If the visitor has deleted the cookie, then Yahoo! Web Analytics will identify them as a first time visitor and re-issue a new first-party cookie.
Yahoo! Web Analytics Tracking Workflow
- Visitor types URL into the address bar of the browser.
- Page starts loading.
- Images, .js files etc. load in the sort order as they are referred in the page, including the ywa.js file. (The ywa.js is a 10K file and is located on Yahoo!'s high-availability mirrors. The load time of this file solely depends on the browsers connection to client's web server.)
- All tracking scripts and other scripts get executed that are located before the ywa.js
- If JavaScript is supported, the ywa.js starts running.
- If JavaScript is not supported, then we use third-party cookie tracking and make a pixel request. Then we go straight to step 10 and the response.
- ywa.js: collects basic page and browser information (e.g., operating system, browser).
- ywa.js: collects other customization parameters (e.g., action, custom fields).
- ywa.js: sets an onLoad event (which will track downloads and exit links).
- ywa.js: looks for the first party cookies. If a first party cookie exists, it is appended to the request.
- ywa.js: creates a script object, and calls its source: the URL contains all the information we need to track the page.
- ywa.js: the script that returns may update to the first party cookie.
- If all the referred items have finished loading, and all the scripts have finished running, the onLoad event occurs.
- The original onLoad event gets executed first (if any).
- The Yahoo! Web Analytics onLoad event gets executed: it places an onClick event on all the links on the page, to be able to track downloads and exit links.
- Page finishes loading.
- If a download, exit link, or a manually tagged event occurs on the page, the tracking server is called again to track that event.
Page initialization
Detecting support
Collecting data and handling cookies
URL request and reply
(Typically, steps 5-10 don't take longer than 200-300ms to run, depending on the browser's connection to Yahoo! Web Analytics data collection server.)
Attaching to page events
(Typically, steps 12-13 don't take longer than 20ms to run, depending on the processing power of the visitor’s machine and the number of clicks on the page.)
Completion of process
Sending the HTTP request
After the ywa.js has completed executing, the request to the Yahoo! Web Analytics data collection server is as follows:
| http://a.analytics.yahoo.com/fpc.pl?a=1000123456789&v=5.09&enc=UTF-8 &b=Internet%20Marketing%20Company%20-%20SEO%20%26%20Pay%20Per%20Click%20Management%20Services &f=http%3A%2F%2Fwww.example.com%2F&flv=Shockwave%20Flash%2010.0%20r42 &d=Thu%2C%2018%20Feb%202010%2022%3A50%3A01%20GMT&n=5&g=en-US&h=Y &j=1920x1200&k=32&l=true&ittidx=0&fpc=e1t-e3vP%7Cm4y4WX7Jaa%7Cfses1000123456789%3D%7Cm4y4WX7Jaa%7Ce1t -e3vP%7Cfvis1000123456789%3DZj1odHRwJTNBJTJGJTJGcHVyZXZpc2liaWxpdHkuY29tJTJGJmI9SW50ZXJuZXQlMjBNYXJr ZXRpbmclMjBDb21wYW55JTIwLSUyMFNFTyUyMCUyNiUyMFBheSUyMFBlciUyMENsaWNrJTIwTWFuYWdlbWVudCUyMFNlcnZpY2Vz %7C8s001MMMoM%7C8s001MMMoM%7C8s001MMMoM%7C8%7C8s001MMMoM%7C8s001MMMoM |
The request above is a standard request which does not include actions and custom fields.
Please note that in addition to this, we also store the IP address from the origin of the request, together with related demographic data based on the IP address.
| URL Parameter | Description | Value |
|---|---|---|
| a | 1000 + project id | 1000123456789 |
| v | Tracking code version | 5.09 |
| b | YWATracker.setDocumentName("Home"); | Home |
| enc | Character encoding | utf-8 |
| f | Page URL | http%3A%2F%2Fwww.example.com%2F |
| flv | Operating system | Shockwave%20Flash%2010.0%20r42 |
| d | Date and time | Thu%2C%2018%20Feb%202010%2022%3A50%3A01%20GMT |
| n | Time zone offset | 5 |
| g | Browser language | en-US |
| h | Java enabled | Y |
| j | Monitor resolution | 1920x1200 |
| l | First-party cookies | true |
| ittidx | Multiple call creation ID | 0 |
| fpc | Cookie ID | e1t-e3vP%7Cm4y4WX7Jaa%7Cfses1000123456789%3D%7Cm4y4WX7Jaa %7Ce1t-e3vP%7Cfvis1000123456789%3DZj1odHRwJTNBJTJGJTJGcHV yZXZpc2liaWxpdHkuY29tJTJGJmI9SW50ZXJuZXQlMjBNYXJrZXRpbmcl MjBDb21wYW55JTIwLSUyMFNFTyUyMCUyNiUyMFBheSUyMFBlciUyMENsa WNrJTIwTWFuYWdlbWVudCUyMFNlcnZpY2Vz%7C8s001MMMoM%7C8s001M MMoM%7C8s001MMMoM%7C8%7C8s001MMMoM%7C8s001MMMoM |
| c | YWATracker.setDocumentGroup("Products"); | c=Products |
| ca | This parameter corresponds to the submit_action() function, which triggers an action without tracking a page view. | ca=1 |
| cq | YWATracker.setCmpQuery("ref=Campaign1"); | cq= ref=Campaign1 |
| e | Tracks referring URLs. | e=http%3A%2F%2Fwww.google.com%2F |
| oa | YWATracker.setAmount("USD350.00"); | oa=USD350.00 |
| oc | YWATracker.setOrderId("1001"); | oc=1001 |
| xt | YWATracker.setTax("1.00"); | xt=1.00 |
| xs | YWATracker.setShipping("5.00"); | xs=5.00 |
| xd | YWATracker.setDiscount("2.00"); | xd=2.00 |
| p | YWATracker.setSKU("H84963422"); | p=H84963422 |
| q | YWATracker.setUnits("7"); | q=7 |
| r | YWATracker.setAmounts("50.00"); | r=50.00 |
| x | YWATracker.setAction("01"); | x=01 |
| cfN (where N = the number of the custom field | YWATracker.setCF(15, "62");YWATracker.setCF(7, "abcdefgh"); | cf1=62cf19=abcdefgh |
| m | YWATracker.setMemberId("john"); | m=john |