views:

17

answers:

1

I have a site that I'm optimizing using Google Website Optimizer where the goal is to have someone click on a link to download some software. But the google optimizer code that's provided will get triggered on any page where the link is on. Is there any way to have it execute only when someone actually clicks the download button? Thanks so much!

A: 

Nevermind, found a blog post that explains a few ways http://www.conversionvoodoo.com/blog/2010/05/how-to-track-conversions-without-a-conversion-page-in-google-optimizer/

I'll use this method:

Put this in the head:

<!-- Google Website Optimizer Conversion Script -->
<script type="text/javascript">
if(typeof(_gat)!='object')document.write('<sc'+'ript src="http'+
(document.location.protocol=='https:'?'s://ssl':'://www')+
'.google-analytics.com/ga.js"></sc'+'ript>')</script>
<!-- End of Google Website Optimizer Conversion Script -->

<!--Create our own function that only reports the conversion when we call it -->
<script type="text/javascript">
function reportConversion() {
try {
var gwoTracker=_gat._getTracker("UA-XXXXXXXX-X");
gwoTracker._trackPageview("/XXXXXXXXXX/goal");
}catch(err){}
} return true;
</script>

Set an event handler:

&lt;input onClick="return reportConversion()" type="button" /&gt;
Shane N