onClick question

JavaScript and client side scripting.

Moderator: General Moderators

Post Reply
avios
Forum Newbie
Posts: 1
Joined: Sun Oct 10, 2010 4:58 pm

onClick question

Post by avios »

Hello,
I have the following button on my site:

Code: Select all

<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.

onClick="goalTrack();"

<script>
 function goalTrack(){
	var pageTracker=_gat.getTracker("UA-XXXXXX");
	pageTracker._trackPageview("/kkkkkkkkk/goal");
}
</script>

Thank you!
Last edited by Benjamin on Sun Oct 10, 2010 6:28 pm, edited 1 time in total.
Reason: Added [syntax=html] tags.
User avatar
s.dot
Tranquility In Moderation
Posts: 5001
Joined: Sun Feb 06, 2005 7:18 pm
Location: Indiana

Re: onClick question

Post by s.dot »

onclick="goaltrack(); return dosearch();"
Set Search Time - A google chrome extension. When you search only results from the past year (or set time period) are displayed. Helps tremendously when using new technologies to avoid outdated results.
Post Reply