How to add Google Tag Manager code in Beans

How can i add GTM code in Head meta footer.

Just add that to you functions.php. Change your ID!

// Add Google Tag Manager after <body>
beans_add_smart_action( 'beans_body_prepend_markup', 'j0e_add_google_tag_manager' );

function j0e_add_google_tag_manager() {

  <noscript><iframe src="//"
  height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>
  new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],


Jochen Gererstorfer Thanks Dear

I was trying to do this as well. There are two sets of code: one goes as high in tag as possible, the other goes right after the tag.

The above works well for the part after . But how would you put the code in the tag?

EDIT: Pardon me, just answered my own question. You just use beans_head_prepend_markup.

Yes thats the new tagmanger code.

That code in the <head is important, if you want to drive A/B tests.

Write a reply

Login or register to write a reply, it's free!