Search Help:  
 
Enter keywords to search help.

Tracking code variables

Tracking variables, functions, and locations

The table below lists the variables used by Yahoo! Web Analytics tracking code, and includes details on the function the variable performs, which pages it applies to, and if the variable is required or optional. In the section below this table, you will find a list of which variables can be customized, and examples of how to format and insert custom values into each variable.

Variable Function Performed Location
YWATracker.set
DocumentName("xxx");
Sends the page name used in reports Every page (optional) If a custom value is used, it will override the HTML page title (default) in reports.
* Values may contain up to 75 characters
YWATracker.set
DocumentGroup("xxx");
Sends the name of the "group" the page belongs to Pages you want grouped for reporting purposes (optional)
YWATracker.setMemberId("xxx"); Sends the member ID of a registered user (if logged in). Order Confirmation page
User Profile page
User Edit Profile page
* Applies only to merchants with access to Customer Registration (legacy Yahoo! Store feature)
YWATracker.setAction("01"); Sends completed sale information

Note: Additional Actions (02>10) may be specified as numbers in the tracking code, and then assigned a label in the user interface
Order Confirmation page
YWATracker.set
Action("PRODUCT_VIEW");
Sends the number of product views (associated with the item SKU) Product page
YWATracker.set
Action("ADD_TO_CART");
Sends the number of items added to the basket/cart (associated with the item SKU) Page after user adds to cart
YWATracker.setAmount("xxx"); Sends the order subtotal
Associated with YWATracker.setAction("01");
Order Confirmation page
YWATracker.setAmounts("xxx"); Sends a semicolon separated list of unit prices of each product Order Confirmation page
YWATracker.setOrderId("xxx"); Sends the order ID
Associated with YWATracker.setAction("01");
Order Confirmation page
YWATracker.setTax("xxx"); Sends the tax amount
Associated with YWATracker.setAction("01");
Order Confirmation page
YWATracker.setShipping("xxx"); Sends the shipping charges applied to the sale Order Confirmation page
YWATracker.setDiscount("xxx"); Sends the discount applied to the sale (for example, a coupon discount) Order Confirmation page
YWATracker.setUnits("xxx"); Sends a semicolon separated list of quantities for each item Order Confirmation page
YWATracker.setSKU("ITEMID"); Sends a semicolon separated list of item IDs contained in an order
Note: "PRODUCT_VIEW", "ADD_TO_CART" and "Action("01")" are all linked to the SKU variable.
Order Confirmation page
Product View page
Add to Cart page
YWATracker.set
CmpQuery("xxx");
Sends the tracking URL information (campaign identifier) if a site is set to remove the original URL tracking string. Every page (if appropriate)
YWATracker.set
Action("INTERNAL_SEARCH");
Counts the number of internal searches Internal Search Results page
* Pages built in Store Editor only
YWATracker.setISK("xxx"); Sends the query string used during the internal site search Internal Search Results page
* Pages built in Store Editor only
YWATracker.setISR("xxx"); Sends the actual number of search results during the internal site search Internal Search Results page
* Pages built in Store Editor only
YWATracker.set
CookieDomain("xxx");
Used to prevent visit sessions from being broken when a visitor moves between different domains in a single project Tracked pages that exist within the second domain
YWATracker.setDomains("xxx"); Prevents exit links being tracked when a visitor moves between domains.

Note: The sub-domain(s) must also have tracking code installed
Every page containing links to the second domain
YWATracker.setFlashUrl("xxx"); Used to ensure a meaningful value is passed for the Page URL reports when tracking Flash properties (if not used, the Page URL would simply read "Flash") Pages that link to the Flash URLs on a different domain

Customizable variables

Tracking code variables that can be customized are listed below, along with examples of how to format and insert custom values into each variable. For more information about customizing your tracking code, please see "Customizing Yahoo! Web Analytics tracking code."

DocumentName
You can customize this variable in the tracking code of pages that you would like to assign a specific title to. The value of this variable is only used for reporting purposes, and will not be seen by site visitors.

Variable example:
YWATracker.setDocumentName("YourCustomNameGoesHere");

DocumentGroup
You can customize this variable in the tracking code of pages you wish to track as part of a group of documents. The value of this variable is only used for reporting purposes, and will not be seen by site visitors.

Variable example:
YWATracker.setDocumentGroup("YourCustomGroupNameGoesHere");

Action
Common use of actions is on a confirmation or thank you page. They can also be set for events, such as clicking on a button or link, tracked as "on-click" actions.

Action 01 is pre-configured to record the Sale action. You can create up to nine other actions to include in your tracking code, using the available action numbers 02 to 10.

For example, if you'd like to create an action to track email signups, and assign it action number 02, you can create a new variable for the tracking code that is used on your email signup confirmation page.

Variable example:
YWATracker.setAction("02");

Example tracking code using the new variable:
<script type="text/javascript" src=" http://d.yimg.com/mi/ywa.js " ></script>
<script type="text/javascript">
YWATracker = YWA.getTracker("1000111111111");
YWATracker.setDocumentName("PAGEID");
YWATracker.setDocumentGroup("Store");

YWATracker.setAction("02");
YWATracker.setDomains("*.store.yahoo.net");
YWATracker.submit();
</script>

Next, assign your new action variable a label in the Yahoo! Web Analytics reporting interface:

  1. In Store Manager, click the Yahoo! Web Analytics "Analytics Reports" link.
  2. Click the "Settings" link, located near the top of the page.
  3. On the Settings page, locate the Action Tracking section. Click the "Track sales, revenue, form submissions, downloads, and custom actions" link.
  4. In the reporting interface, Action #2 is pre-populated with the label "SIGNUP." You may choose to keep this label, as it describes the signup action. If the label does not describe the action, you may wish to change it.

    To customize the label (for example, to specifically call it "Email Signup," enter new label text into the Action #2 field (Figure 1).

    Assign an action label to your new action
    Figure 1. Assign an action label to your new action.

  5. Once you've entered a label for your action, choose whether or not to make it a unique action. Learn more about unique actions.
  6. Click the Update button to save your action label.

CookieDomain
If you are tracking pages on a second site (Site B) that has a different domain name and want the tracking session for the first site (Site A) to end when a visitor navigates from Site A to Site B, include this variable in the tracking code of all pages being tracked for Site B.

Variable example:
YWATracker.setCookieDomain("site-a-domain.com");

Domains
This variable is used to track site subdomains. The value of this link should be formatted as follows: "wild card (*) + main domain name" (see the example below).

Variable example:
YWATracker.setDomains("*.abc.net")

FlashURL
If you link to a Flash file on your site, you can track the file by including the Flash page URL in this variable and including the variable in the tracking code used for the page on which this link appears.

Variable example:
YWATracker.setFlashURL("http://location-of-flash-file.com");

Can I create custom fields?

Yahoo! Web Analytics does not currently support custom fields. If a custom field is added to your tracking code, it will not be reflected in your reports.

How do I disable a variable?

To disable a variable, place two slashes ( // ) before it. The example below shows the DocumentGroup variable disabled in the tracking code for item pages:

<script type="text/javascript" src=" http://d.yimg.com/mi/ywa.js" ></script>
<script type="text/javascript">
YWATracker = YWA.getTracker("1000111111111");
YWATracker.setDocumentName("ITEMID");

//YWATracker.setDocumentGroup("ProductView");
YWATracker.setDomains("*.store.yahoo.net");
YWATracker.setSKU("ITEMID");
YWATracker.setAction("PRODUCT_VIEW");
YWATracker.submit();
</script>

To reactivate a disabled variable, remove the two slashes that have been placed before it.

Note: Yahoo! Web Analytics beta release is only available with Merchant Solutions Standard, Professional, and Yahoo! Store plans. This feature is not included with Merchant Solutions Starter plans.

Was this article helpful?

Yes   No
Click to contact Customer Care for further assistance.