Mobile app version of vmapp.org
Login or Join
Smith883

: How do I track clicks in GA on dynamically created buttons? We have a region in our website where we show two buttons: "Sign in" and "Sign up now" if the user is not signed in. If the

@Smith883

Posted in: #GoogleAnalytics #GoogleTagManager

We have a region in our website where we show two buttons: "Sign in" and "Sign up now" if the user is not signed in. If the user is signed in, we display a button "Access App". These buttons are dynamically created using Javascript, depending on whether the user is signed in or not.

How do I track clicks on these individual buttons in Google Analytics? Is this possible using GTM and the link click listener?

10.01% popularity Vote Up Vote Down


Login to follow query

More posts by @Smith883

1 Comments

Sorted by latest first Latest Oldest Best

 

@Heady270

It's harder to do with dynamic buttons, but assuming you don't have a static CSS ID that you can target off of for each button, and that the button text doesn't change ("Sign In", "Sign up now", "Access App"), then, yes, you can use GTM and a link click listener to track these clicks. You may need to add some additional logic, via custom JS, to see if the button text matches. If you have multiple occurrences of those buttons on the same page, you could possibly check if they are within certain divs on the page as well, again using custom JS.

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme