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