Add Onclick Event To Elementor Button (Tutorial)
How To Add Onclick Event To Elementor Button
How to Track โButton onClickโ Event (for Facebook Pixel, Google Analytics or Google Tag Manager)
If you’re running ads on Facebook (Meta) Ads, then you may be interested in adding an onclick event to your buttons in Elementor to track your conversions, sales, and leads.
To do that, follow these steps:
Follow these steps to track button onClick events:
- Edit Button > Advanced > set CSS ID = My_Button
- Add an HTML widget to the page (after the button will be fine)
- Paste the following code into the HTML Code field:
<script>
document.addEventListener("DOMContentLoaded", function(event) {
jQuery('#My_Button a').click(function(){
// tracking code here
// for example Facebook Pixel:
fbq('track','AddToCart');
});
});
</script>
Add the following CSS to your sites custom CSS region. This may be in your Theme Customizer, Site Settings, Custom Code, or child theme.
Elementor is an amazing website builder plugin for WordPress. Elementor makes it easy to create beautiful and high converting websites yourself without having to learn code.
- 100% Flexible
- No Coding Necessary
- Thousands of Pre-Built Templates
- Wordpress Only
๐Resources To Supercharge Your Marketing
๐ How I’ve Been Earning Consistent Passive Monthly Commissionsโ
๐Get The #1 Affiliate Training For 2022 ๐
๐ Best Affiliate Tools & Resources | <<< My Favorite Affiliate Resources
๐.120 Top Recurring Affiliate Programs | <<< Download Free PDF
๐บ Check Out My Latest Youtube Video | <<< Good Stuff
๐ฒ Want 1-on1 Help With Your Business? | <<< Book A Coaching Call
๐ฅ Ready To Get Traffic With Bing? | <<< (Yes, It’s Still Working In 2022)
๐งฐ Digital Marketing Tools & Resources | <<< Speed Up Results With These
โ “Gamify” Your Productivity | <<< Free Tool To Gamify Productivity
๐ย Download My Commission Trackerย |ย <<<ย Track Commissions. Stay Motivated!
๐ค AI Tool I Use To Write SEO Articles | <<< Create Ranking Content On Autopilot
โ๏ธ WP Plugin That Builds SEO Sites For You | <<< Create “Assets” On Autopilot
๐ Good Course For Newbie Affiliates | Start With Free Traffic & Build Up
๐ Affiliate Book For Just $1 | <<< How To Get Started With Affiliate Marketing