Skip to search.

Breaking News Visit Yahoo! News for the latest.

×Close this window

Custom Fields Guide

Last Updated: March 28, 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.

This document is a quick start guide which explains how to use Custom Fields in Yahoo! Web Analytics.

What are Custom Fields?

Occasionally the standard reports in Yahoo! Web Analytics do not provide all of the specific data that a user will need. Yahoo! Web Analytics enables users to use their own custom fields for circumstances in which standard tracking will not suffice. These custom fields let users collect site-specific information and then display it through the custom reporting feature in the user interface.

In most cases, setting this and using custom fields is a simple procedure. You select a custom field type and a parameter is added to the tracking code to hold the data (the user is responsible for inflating the data into the parameter).

Custom fields can track a wide array of information and a full illustration of use can be found in the Example of Usage. However, some simple examples of usage would be to capture information on membership types, tracking creatives in a banner campaign, or providing details about an action performed on a page.

Basic Setup

To edit a custom field:

  1. Go to Settings > Custom Fields.
  2. Find the field you want to edit and click the pencil icon next to it to open the Settings for Custom Field overlay. At a minimum, you should change the Name element (the label visible in your report) to reflect the data collected and check the display box.
  3. Add the custom field to your tracking code.

The following is an example of a simple instance of a custom field with the standard tracking code (custom field 7 with a value of "Cats"):

<!-- Yahoo! Web Analytics - All rights reserved -->
<script type="text/javascript" src="http://d.yimg.com/mi/ywa.js"></
script>
<script type="text/javascript">
var YWATracker = YWA.getTracker("1000123456789");
YWATracker.setDocumentName("HomePage");
YWATracker.setDocumentGroup("Standard Pages");
YWATracker.setCF(7, "Cats");
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>

More extensive code samples can be found in the section Code Examples.

When this is completed and the data begins to be collected, you can see the information by using custom reporting to either create a new report with the custom field and associated metrics or by customizing a current report.

Elements on the Custom Field Settings Page

Groups

Assign your fields into logical groups. The standard groups are Content Hierarchy, E-Commerce, Internal Search, Campaign Attributes, and Non-Categorized (which is the default for new custom fields). New groups can be created in the interface by clicking on Assign Custom Fields to Specific Groups at the bottom of the page.

This will open the following screen, which lets you define your own groups.

Groupings do not impact your reporting in any way; they let you apply your own order to the custom fields you use for ease of reference on this page.

Tracking code ID

The numerical identifier for the custom field. Use this number in the coding to identify the custom field.

Custom Field Name

The name of the custom field. This is the label that you find in reporting groups when creating custom reports.

Custom Parameter

In cases where you need to get the value for the field from a URL string, you can enter a parameter here and then use that within the URL along with the value. This removes the need to include the custom field in the tracking code itself. This feature is most commonly used to gather information related to campaigns.

Carry-over Option

This option lets you specify the number of pages for which the value is tracked. By default the value is No carry-over. However, you can choose to select the value to carry over, either until the visit ends or a particular action occurs. An example might be a page-view-based custom field set to be carried over until action 01 (sale) occurs. In this case, the value for the custom field will be carried over and applied to each page viewed until the sale action occurs. A real world application for this case would be to see how many pages auser browsed before a sale occurred.

Status

This indicates whether the field is active or not. It is not possible for the user to edit this value.

Scope

This indicates the scope of the custom field. This cannot be altered for a particular field. More details can be found in the section on Available Scopes.

Display

You must check this box for the custom field to be available in the custom report wizard and generated reports.

Available Scopes

There are four basic scopes available for custom fields:

Session

This scope collects data for the whole session. If more than one value is assigned during a session, the last value collected will be the one that is stored.

Page View

This scope collects data on a page-to-page basis. This data will only be related to the particular page from which it is triggered unless the carry-over option is changed.

Action

This scope associates the custom field with a particular action. This data will only be related to the particular page from which it is triggered unless the carry-over option is changed.

Campaign

This can be used to gather further information from campaigns. It is common to use the custom parameter option to gather the information directly from the URL string. This data will only be related to the particular page from which it is triggered unless the carry-over option is changed.

These are further broken down by the type of characters allowed for the value:

  • String – for alphanumeric characters.
  • Number 0-2m – for numeric characters.
  • Date – for date based information.

These definitions are the same for each scope.

Relationships between Scopes and Other Common Problems

Perhaps the single most common problem with custom fields occurs when using groups and/or metrics that conflict with each other. For example, adding a metric that reports on page-based details (average time on page) to campaign-related report groups that do not display any page-based details (but are visit-based instead) would be just such a mismatch. When this occurs, the user will either end up with an empty report or a report that shows incorrect data. You must take care when choosing the correct scope for a custom field.

One other thing that needs to be understood when setting up custom fields is the scope and any associated events. All custom fields must collect data related to their scope so that they can be displayed. In the case of session- and campaign-based scopes, the association is part of the normal operation of the site (there will always be a session or campaign recorded with it).

A custom field with an action scope will always need to have an action submitted with it. For example, suppose you have created a custom field to track room types selected on an online booking site. The only way the custom field will be displayed is if an action (say, a "booking confirmation" action), is submitted along with it at the same time.

Page-view based custom fields are normally tracked without needing to send in any page view information, as the execution of the standard tracking code on a page records a page view. In a situation where the option to submit only an action is used in the tracking code, a problem will occur, as no page view is submitted. For example, tracking an onclick event that doesn’t result in a new page or the page being reloaded. In this situation a different scope may be required or a page view may need to be forced in the tracking.

Custom Reporting

The previous sections have dealt with the mechanics of creating and implementing custom fields. This is useless unless there is a way of reporting on these fields. Custom reporting lets you modify (or create from scratch) reports which show only the groups and metrics that an analyst wants to see.

There are two ways to implement custom reporting. The simplest is to click the customize report button:

A popup appears, containing the current groups and metrics. Custom fields can then be added as desired (within the constraints of the nature of the report).

The other way is to go to Settings > Custom Report > Build Custom Reports. Whatever groups (including custom fields) and metrics are needed can then be added.

Custom fields appear in the groups section with the label name you applied on the Custom Field settings page.

Once the report is complete, you can bookmark this report for further use by clicking on the bookmark icon.

This brings up the following dialog, which lets you save the report in a way most useful to the analyst.

  • Name — the title for the report.
  • Description (optional) — any description needed.
  • Read/Edit Rights — specify who can see/edit the bookmark you’ve created.
  • Timing — choose the time frame. We recommendyou use the first option, Display data based on current calendar settings if a report is ongoing and may be used against different time frames. Choose the second option, specific date(s), if you want to focus on one period.
  • Save segment selection — allows any segmentation set up on the report to be saved within the bookmark.
  • Save sorting — if the report has been sorted by a particular metric, this will save the sorting in the bookmark.
  • Folder — save the bookmark into a particular folder. If there are no folders, or to specify a new one, type the name into the field to create it.

When all options have been selected, click Create Bookmark to save the bookmark.

Example of Usage

The client has a travel-based site. They like the basic stats that Yahoo! Web Analytics provides them, but it doesn't cover all of their needs. Besides the basic stats, they need to know information about the room booked (room type), the type of visitor (normal or Rewards Program), and also which creative in a revolving banner ad is sending traffic to the site. Custom fields can be created to capture these three pieces of information that are vital to the client.

  1. We'll start with tracking the creative. The client wants the banner to be tracked as a single campaign but also wants to note differences in performance between the creatives. A custom field will be used to capture this extra information. Since this is related to campaigns, a campaign-based custom field will be created to capture this information. The field is assigned in Settings > Manage Custom Fields. Along with the standard information, a custom parameter is defined here to gather information from the visitor’s landing page URL. In this case we’ll define it as 'creative':

  2. The next step is for the client to edit the destination URLs for each creative and add the parameter "creative" and its value. Using the original destination URL of:

    http://www.example.com?cmp=banner

    The edited link would look something like this:

    http://www.example.com?cmp=banner&creative=1

  3. The campaign summary report can then be customized to show the creative parameter.

The type of visitor is determined on the site by whether or not a visitor has logged in at some point. While we could use an action-based custom field to track the login and gather the number of visitors logging in, a session-based field would allow us to assign a complete visit path for that particular visitor type. This can be very useful when segmenting different visitors. So again, the custom field is created but we're not going to use a custom parameter in this situation, as the information will be passed in the tracking code. The custom field will be designated as _s_cf03 in the UI, and will be passed in the following code on the confirmation of login page:

<!-- Yahoo! Web Analytics - All rights reserved -->
<script type="text/javascript" src="http://d.yimg.com/mi/ywa.js"></
script>
<script type="text/javascript">
var YWATracker = YWA.getTracker("1000123456789");
YWATracker.setDocumentName("Members Home");
YWATracker.setDocumentGroup("Membership");
YWATracker.setCF(3, "Rewards Program");
YWATracker.submit();
</script>
<noscript>
<div><img src="http://a.analytics.yahoo.com/
p.pl?a=10001387510412&js=no" width="1" height="1" alt="" /></div>
</noscript>

This visit will have a value of "Rewards Program". This information can be displayed in a custom report but could be very effective as the basis for a segment to separate visitors between standard clients and those in the rewards program. Most of the reports in the system can be segmented to show how each class is performing next to each other.

Finally we have the room type. This will occur on the sales confirmation page, as it is part of the sales process. Since it's related to a particular conversion, we will create an action-based custom field to track it. In this instance, custom field 20 will be used to hold the value for the room type. The code would look something like the following:

<!-- Yahoo! Web Analytics - All rights reserved -->
<script type="text/javascript" src="http://d.yimg.com/mi/ywa.js"></
script>
<script type="text/javascript">
var YWATracker = YWA.getTracker("1000123456789");
YWATracker.setDocumentName("Confirmation");
YWATracker.setDocumentGroup("Sales");
YWATracker.setAction(“01”);
YWATracker.setAmount(“EUR200”);
YWATracker.setOrderid(“12345”);
YWATracker.setCF(20,"Single");
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>

The value for the custom field will be recorded as Single. A good use of this in the reports would be to create a custom report showing the different room type alongside the number of conversions to see how they are all performing.

So by using 3 simple custom fields, this client is able to get much more granular data than by using only basic tracking.

Code Examples

Standard Custom Field

This is the standard tracking code that will capture a custom field (cf7) on the load of the page. The value in this case will be Cats.

<!-- Yahoo! Web Analytics - All rights reserved -->
<script type="text/javascript" src="http://d.yimg.com/mi/ywa.js"></
script>
<script type="text/javascript">
var YWATracker = YWA.getTracker("1000123456789");
YWATracker.setDocumentName("Pets and More");
YWATracker.setDocumentGroup("Animals");
YWATracker.setCF(7, "Cats");
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>

Multiple Custom Fields

This example shows how to capture multiple custom fields on the same page load. In this case we're capturing custom fields 7 and 8 with values of Cats and Dogs, respectively.

<!-- Yahoo! Web Analytics - All rights reserved -->
<script type="text/javascript" src="http://d.yimg.com/mi/ywa.js"></
script>
<script type="text/javascript">
var YWATracker = YWA.getTracker("1000123456789");
YWATracker.setDocumentName(“Pets and More");
YWATracker.setDocumentGroup("Animals");
YWATracker.setCF(7, "Cats ");
YWATracker.setCF(8, “Dogs”);
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>

Custom Field in a Wrapper Function

<script language="Javascript">
function captureOnclick(actionnumber, pettype) {
var YWATracker = YWA.getTracker("1000123xxxx");
YWATracker.setAction(actionnumber);
YWATracker.setCF(17, pettype);
YWATracker.submit_action();
}
</script>
<a href="ref.htm" 'Cats')";><img
src="IMG_abc.png">
<!-- Yahoo! Web Analytics - All rights reserved -->
<script type="text/javascript" src="http://d.yimg.com/mi/ywa.js"></
script>
<script type="text/javascript">
var YWATracker = YWA.getTracker("1000123456789");
YWATracker.setDocumentName("Pets and More");
YWATracker.setDocumentGroup("Animals");
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>

Multiple Custom Fields in a Wrapper Function (Same Event)

<script language="Javascript">
function captureOnclick(actionnumber, pettype, breed) {
var YWATracker = YWA.getTracker("1000123xxxx");
YWATracker.setAction(actionnumber);
YWATracker.setCF(17, pettype);
YWATracker.setCF(18, breed);
YWATracker.submit_action();
}
</script>
<a href="ref.htm" onClick= captureOnclick( 'Cats', 'Manx')";><img
src="IMG_abc.png">
<!-- Yahoo! Web Analytics - All rights reserved -->
<script type="text/javascript" src="http://d.yimg.com/mi/ywa.js"></
script>
<script type="text/javascript">
var YWATracker = YWA.getTracker("1000123456789");
YWATracker.setDocumentName("Pets and More");
YWATracker.setDocumentGroup("Animals");
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>

Multiple Custom Fields in a Wrapper Function (Different Events)

<script language="Javascript">
function captureOnclick(actionnumber, pettype) {
var YWATracker = YWA.getTracker("1000123xxxx");
YWATracker.setAction(actionnumber);
YWATracker.setCF(17, pettype);
YWATracker.submit_action();
}
</script>
<script language="Javascript">
function captureOnsignup(actionnumber, client) {
var YWATracker = YWA.getTracker("1000123xxxx");
YWATracker.setAction(actionnumber);
YWATracker.setCF(18, client);
YWATracker.submit_action();
}
</script>
<a href="ref.htm" onClick="captureOnclick( '06', 'Cats')";><img src="IMG_abc.png">
<a href="ref.htm" onClick="captureOnsignup( '07', 'Pet Owner')";><img src="IMG_abc.png">
<!-- Yahoo! Web Analytics - All rights reserved -->
<script type="text/javascript" src="http://d.yimg.com/mi/ywa.js"></
script>
<script type="text/javascript">
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>

Dynamically Created Metrics for Numeric Custom Fields

The custom report wizard dynamically creates metrics for numerical Custom Fields and make them available in reporting.

For numerical custom fields, two new metrics are dynamically created:

  • Total {Field}
  • Avg. {Field}

Where {Field} is the name of the field you created).

When defining a numerical field (via Settings > Manage Custom Fields), users can specify one of three formats:

  • Numeric - standard numeric value.
  • Currency - calculated as numeric and displayed in appropriate currency at the reporting level.
  • Duration - calculated according as seconds, and breaks out into hours, minutes, seconds remaining at the reporting level.

Display of custom field groups and metrics is based on the "Display" setting for the custom field. Custom field groups and metrics are visible only if the custom field is displayed. You can edit this setting for a custom field using the Settings > Custom Fields > Manage custom fields option. Edit the field and set the Display option to make it available or hidden.

If you choose to turn off the display of a custom field, and that custom field is in use, you'll be notified that certain items (such as scheduled emails and bookmarks) using that field will be deleted. Re-enabling display for the custom field will make it available for use once more.

Re-enabling display of a custom field will re-enable it in any bookmarks, dashboards, or scheduled reports.

Note: If a numeric custom field is stored in an Audience Definition Segment Export the user cannot disable display (via Manage Custom Fields). The user will see an alert notifying them that it is being used in one of the above instances.

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