Skip to search.

Breaking News Visit Yahoo! News for the latest.

×Close this window

Do I use the same tracking code for secure and non-secure pages?

Last Updated: March 19, 2012
Text Size: A A A

Save to My Help

Save this article to My Help for easy reference. You can visit the article at any time from any computer.

Replace an article

You have reached the maximum number of saved articles. Your oldest saved article will be replaced with the new one.

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>

Was this information helpful?      

My Help

Forgot your ID or password?

Sign In

Sign in to see your account information saved articles and more.
  1. Recent Searches (0)

  2. Saved Articles