Title: Add code to Buttons
Last modified: November 24, 2024

---

# Add code to Buttons

 *  Resolved [streamworksaudio](https://wordpress.org/support/users/streamworksaudio/)
 * (@streamworksaudio)
 * [1 year, 6 months ago](https://wordpress.org/support/topic/add-code-to-buttons/)
 * Hi,
 * I am just wondering if there is way to add some JS to a Adv Button? I was hoping
   to push something to the Google Tag manager data layer when the user clicks on
   a button.
 * Cheers!

Viewing 3 replies - 1 through 3 (of 3 total)

 *  Thread Starter [streamworksaudio](https://wordpress.org/support/users/streamworksaudio/)
 * (@streamworksaudio)
 * [1 year, 6 months ago](https://wordpress.org/support/topic/add-code-to-buttons/#post-18156890)
 * I was able to do this by adding an ID to the button (a tag) then using a code
   snippet to add <script> (with the wp_footer hook) which listens for the click
   on the ID and then pushes to the datalayer.
 *  Plugin Support [karlalevelup](https://wordpress.org/support/users/karlalevelup/)
 * (@karlalevelup)
 * [1 year, 6 months ago](https://wordpress.org/support/topic/add-code-to-buttons/#post-18163220)
 * Hi there!
 * Glad to know that you already have a workaround. While there is no built-in option
   to do this, I added a vote on your behalf to this existing feature request: **_
   [Advanced Button – add on click function](https://feedback.kadencewp.com/p/advanced-button-add-on-click-function?b=feature-requests-blocks)_**
 * Let me know if I can assist you further with this.
 *  Plugin Support [karlalevelup](https://wordpress.org/support/users/karlalevelup/)
 * (@karlalevelup)
 * [1 year, 6 months ago](https://wordpress.org/support/topic/add-code-to-buttons/#post-18179717)
 * Hi there!
 * It’s been a while since we’ve heard from you. I’ll go ahead and mark this as 
   resolved.
 * Should you need our help again, you may submit a new topic.
 * Have a great day ahead!

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Add code to Buttons’ is closed to new replies.

 * ![](https://ps.w.org/kadence-blocks/assets/icon-256x256.png?rev=3178382)
 * [Kadence Blocks — Page Builder Toolkit for Gutenberg Editor](https://wordpress.org/plugins/kadence-blocks/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/kadence-blocks/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/kadence-blocks/)
 * [Active Topics](https://wordpress.org/support/plugin/kadence-blocks/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/kadence-blocks/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/kadence-blocks/reviews/)

 * 4 replies
 * 2 participants
 * Last reply from: [karlalevelup](https://wordpress.org/support/users/karlalevelup/)
 * Last activity: [1 year, 6 months ago](https://wordpress.org/support/topic/add-code-to-buttons/#post-18179717)
 * Status: resolved