: 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
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?
More posts by @Smith883
1 Comments
Sorted by latest first Latest Oldest Best
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.
Terms of Use Create Support ticket Your support tickets Stock Market News! © vmapp.org2024 All Rights reserved.