Test & Target form tracking

249 views Asked by At

I have been using link tracking on test and target using mboxTrack() and mboxTrackLink(), something like:

<a id="clickable" href="run.html">Click this</a>

<script type="text/javascript">

$('#clickable').on('click',function(e){
e.preventDefault();
mboxTrack("testmbox","",this.href);

});

</script>

This works perfectly for me. The latest issue i am having is what if i have setup a form and and i wanted to track the click from the form something like :

<form action="submit_this.html">
First name:<br>
<input type="text" name="firstname" value="Mickey">
<br>
Last name:<br>
<input type="text" name="lastname" value="Mouse">
<br><br>
<input type="submit" value="Submit">

</form>

How do i go about tracking the 'action' for this form submit. Any suggestions or ideas

1

There are 1 answers

0
sbay On
<form action="submit_this.html">
First name:<br>
<input type="text" name="firstname" value="Mickey">
<br>
Last name:<br>
<input type="text" name="lastname" value="Mouse">
<br><br>
<input type="submit" value="Submit">
</form>

<script type="text/javascript">
$('form').on('submit',function(e){
    e.preventDefault();
    mboxTrack("testmbox","",this.action);
});
</script>