Outlinks on Forms


#1

Is there a way to track an outlink if it the action on a form?

Basically I have a form that when submitted is sent to an external page, and am looking for a way to see how often this form is being submitted.

Thanks.


(vipsoft) #2

<script type="text/javascript">
function doSubmit() {
    // client-side validation (if any)
    // if there's a validation error, return false to cancel the submission
    ...

    // track the outlink and then return true for form data to be sent
    tracker.trackLink('whatever_url_you_want_to_record', 'link');
    return true;
</script>
<form action="submit.php" name="myform" onsubmit="javascript:return doSubmit();">
...