I would like to inject the Google Analytic snippet before the closing head tag when a button is clicked. Could you please tell me how to achieve this? I am using jQuery if that helps at all. Thanks in advanced for the reply!
"inject" is a phrase more commonly associated with hackers. Are you just trying to add specific codes to your analytics tracking?
I understand that, but I couldn't think of a better word. I just want to insert the analytic code predefined in a variable.
Have you checked out the docs at http://code.google.com/apis/analytics/docs/gaJS/gaJSApi.html there are lots of things you can add. If you get stuck come back with a specific question and I'm sure someone will be able to point you in the right direction.
Ok I think I have found something _gat._createTracker('UA-65432-1'); Code (markup): I have implemented it but I'm not sure if its working.