Skip to search.

Breaking News Visit Yahoo! News for the latest.

×Close this window

Can I track onclicks? What about other events?

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.

You can track onclicks and any other JavaScript events that you wish to monitor as actions.

To set up tracking for an onclick event, go to Settings - Action tracking - Track sales, revenue, form submissions, downloads and custom actions and enter your custom action in one of the fields available, e.g., Email Link.

Create a Custom Action for an Email Link

Customize the tracking code on the targeted page - Create a wrapper function

Example


<script language="Javascript">
function captureOnclick(actionnumber,) 
{
  var YWATracker = YWA.getTracker("1000123xxxx");
  YWATracker.setAction(actionnumber);
  YWATracker.submit_action();
}
</script>

Call the onclick

Call the onclick to attach it to the wrapper function and provide values:


<a href="ref.htm" onClick="captureClickout('02')";> <img src="../images/emails/info.gif">

In our example, the action ID for the Email Link action is 02.

Use another wrapper function, as needed

If you need to track additional information about the onclick action (e.g., two custom fields to store extra information associated with the action), you can do so by using another wrapper function.

Example


<script language="Javascript">
function capture_action_and_cfs( action_num , cf_a , cf_b)
{

    YWATracker = YWA.getTracker("1000123xxxx");
    YWATracker.setAction(action_num);
    YWATracker.setCF('17', cf_a );
    YWATracker.setCF('18', cf_b );
    YWATracker.submit_action();
}

Call the onclick

Next, you need to call the onclick, which attaches the onclick to the wrapper function and provides values:


<a href="ref.htm" onClick="capture_action_and_cf( '02','blue' , 'strawberry')">
<img src="IMG_1.jpg">

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