How to show onClick as a completed goal on Google Optimizer

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • romeo ro

    How to show onClick as a completed goal on Google Optimizer

    Hello,

    I have the following button on my site:
    Code:
    <button onclick="return DoSearch('EN','_parent','111', document.getElementById('ySearch').value, 'www.test.com', '112', 'SE')" type="button" style="cursor: pointer; background: url(images/button.jpg);border: none;"> 
    <b style="display: none;">Search</b> 
     </button>
    I would like to add Google Website optimizer and to determine that every time a visitor clicks the button, it will be considered as a goal completion.
    In order to do it, I need to somehow add the below code, but I'm not sure how exactly to do it and would appreciate your help.
    Code:
    onClick="goalTrack();"
    Code:
    <script>
     function goalTrack(){
    	var pageTracker=_gat.getTracker("UA-XXXXXX");
    	pageTracker._trackPageview("/kkkkkkkkk/goal");
    }
    </script>
    Thank you!
  • acoder
    Recognized Expert MVP
    • Nov 2006
    • 16032

    #2
    Does the following not work?
    Code:
    <button onclick="goalTrack(); return DoSearch(.."

    Comment

    Working...