There are two versions of the tracking code: one for standard, non-secure HTTP pages and one for secure, HTTPS pages. You can select the tracking code you need by logging into your Yahoo! Web Analytics account, selecting Installation from the QuickLinks under the relevant project in the Control Center, then choosing the version of the code you need (non-secure or secure).
The listings below show the basic structure for both types of pages. Note that both versions of tracking code take into account whether the user's browser supports JavaScript; the <script>...</script> section is run for JavaScript enabled browsers, while the <noscript>...</noscript> part is run for browsers that have no JavaScript support.
Non-Secure Pages
For non-secure pages, there are four basic sections to the tracking code used on non-secure pages:
- YWA JavaScript Call (non-secure)
- Tracking ID
- Tracking Parameters
- Pixel Request
|
<!-- 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> |
Secure Pages
For secure pages, the same four sections are used. Note, however, that a different script is called:
- YWA JavaScript Call (non-secure)
- Tracking ID
- Tracking Parameters
- Pixel Request
|
<!-- Yahoo! Web Analytics - All rights reserved --> <script type="text/javascript" src="https://s.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="https://a.analytics.yahoo.com/ p.pl?a=1000123456789&js=no" width="1" height="1" alt="" /> </div> </noscript> |