Hi Andrew - providing an easy way to add javascript code for a button’s “click” event is something we would like to do, thanks for suggesting it! In the meantime, you can use jQuery to accomplish what you want - if you publish your page and view the source, you’ll find out what the ID is for the button (in my example below I’ll assume it’s “lp-pom-button-19”). In the “Scripts” section, you can add something like this:
jQuery("#lp-pom-button-19").click(function() { <br /><br />
// handle your google analytics Event Tracking here <br /><br />
}); <br /> }); <br /> </script>```
Hope that helps!
Hi Carter,
In the Form Confirmation page I inserted a button that directs to our FB page. I would like to be able to track this event. I believe your response above helps address this. But I do need further help please…
Would you kindly clarify.
- In google’s instruct for Event Tracking* , we have to replace the link w/ this : s
? Where exactly in the script/ in unbounce are we suppose to insert the above?
- In google’s instruct for Event Tracking* we are to insert the java script for Asynchronous Code.
? Is this still needed or is this replaced by the java script you provided above?
- In the script you provided above, kindly provide an example of what we should replace this section with " // handle your google analytics Event Tracking here"
* Event tracking ](http://www.example.com)http://support.google.com/analytics/b…
Appreciate your help. Thanks
Shell
Btw, here’s the page I refer to above. thx
http://www.new-glaucoma-treatment.com…
Hi Carter,
Could you please provide an example of exactly what the GA Event tracking should look like within that script?
Many thanks
Lucas
This came up again in a support ticket I filed this week because the code provided does not always accurately track all events. I would LOVE to see built-in Event Tracking in the roadmap.
Hey Andrew Ñ it definitely is. Our own marketing team would love to see it too. For now we are focused mostly on the top prioritized stuff in this list, but will be trying to squeeze smaller features in between the big releases.
Hi! I am trying to do something similiar- I am trying to trigger a facebook conversion pixel when a button is pressed:
Here is the facebook javascript I am trying to trigger:
script type=“text/javascript”
var fb_param = {};
fb_param.pixel_id = ‘xxxxxxx’;
fb_param.value = ‘0.00’;
fb_param.currency = ‘USD’;
(function(){
var fpw = document.createElement(‘script’);
fpw.async = true;
fpw.src = ‘//connect.facebook.net/en_US/fp.js’;
var ref = document.getElementsByTagName(‘script’)m0];
ref.parentNode.insertBefore(fpw, ref);
})();
/script
noscript> /noscript
(i had to remove some of the < to make it print)
The button I am trying to fire on is button # 108
Given your instructions above, here is the script I have written:
script type=“text/javascript”>
jQuery(function() {
jQuery("#lp-pom-button-108").click(function() {
var fb_param = {};
fb_param.pixel_id = ‘xxxxxxx’;
fb_param.value = ‘0.00’;
fb_param.currency = ‘USD’;
(function(){
var fpw = document.createElement(‘script’);
fpw.async = true;
fpw.src = ‘//connect.facebook.net/en_US/fp.js’;
var ref = document.getElementsByTagName(‘script’)/0];
ref.parentNode.insertBefore(fpw, ref);
})();
noscript>
});
});
/script>
But I dont htink its working- Im not sure how to properly handlethe fact that is a script opening another script- can you make a clear example of how to do this?
I think the error may be in the noscript/ section?
Thanks
Also does this jquery/javascript go in head/body/after body? thanks
Update:
We’ve implemented a much easier way to implement Google Analytics and Event Tracking on your landing pages by using Script Manager.
Check out the release here:
/topics/new-feature-integrate-google-analytics-event-tracking-with-script-manager
Or check out the full step-by-step guide in our Academy here:
http://documentation.unbounce.com/hc/en-us/articles/203509974-Integrating-with-Google-Analytics?flash_digest=a33c98b7961eed24cb5971106e1b0303a98480f7