I've got a third party app on my website, that allows me to receive bookings for my hostel. The idea is to get some funnel tracking going into google analytics. My access to the code of the app is limited, I'm guessing it will not allow me to insert javascript, because this code will not work even though it shows up in the source code of the iframe on my website:
<a href="mailto:x@xxxx.com.br" onClick="_gaq.push(['_trackEvent', 'BookNowApp', 'BankEmailClicked'])">email</a>
The app will allow me to enter some html code into it's iframe on my website. For example, the link in the above example ended up in the iframe on my website and it works.
So I figure to write some javascript that will trigger when somebody clicks that link in the iframe of the third party app. I plan to load this into the page header:
<script type="text/javascript">
<!--
$('#mailto:x@xxxx.com.br').click(function(){
_gaq.push(['_trackEvent', 'BookNowApp', 'BankEmailClicked']); return false; });
// -->
</script>
The website is http://www.3dogshostelsaopaulo.com (click "BookReserva" for the app)
I'm hoping that with the above script, the only thing I need to incorporate in the HTML of the third party app is that clickable link. Any ideas why this wouldn't work are greatly appreciated!