On button click, against link: we had this:
JavaScript:handleClick();
and I defined handleClick on global CSS/JS section
function handleClick() {
// code
}
The code was working earlier. somehow the javascript function has stopped getting triggered. on clicking the button, the same page gets refreshed and not the javascript code. Kindly help.
I recently updated my wordpress version. Can it be due to this or any other issue?
So what is the recommended option to enable dynamic link on button click?
Basically I’ve used beaverbuilder for a landing page. I have google ads that go to this page. I have written some custom JS function to pass on the google ad parameters from this page to my actual sign up page. so basically i change the window.location from current page to a new page but passing the “?” params that helps google ads track conversions.
The second block of code in the post I linked to will disable that WP security feature and allow you to use javascript in links.
We obviopusly dont reccomend disabling security features. The correct way to use GTM and track clicks is to either add the correct location for the button in the GTM control panel or alternativly write a snippet of JS to watch the button and when its clicked to do your GTM code to track the click.