Integration of Google Tag Manager

Hi! I am wondering if anyone knows how to integrate google tag manager.

it requires two parts - a JS script and an html iframe element in the pages to be tracked.

What I have tried so far…

  • hosting the JS script with rawgit via github and use app.scripts.append_script to add the javascript.
  • and adding an html.Iframe tag in app.layout

However, when I use the preview function offered by Google Tag Manager to get integration validity, the dash page doesn’t seem to be responding.

I am expecting to see a debugging console for GTM to show at the bottom of the browser. It is showing in other html pages but not in the dashboard pages.

Thanks in advance!

Not 100% sure what the problem is, but you might be adding the js code with <script> tags, as opposed to only the code (something I also did). This worked for me with Google Analytics code. Might also work for GTM.

Make sure you do NOT include the <script> </script> tags.

WRONG:

RIGHT:

Hope that helps!

1 Like

Omg you are totally right. Oh dear its such a silly mistake. Thanks so much!

For others who may encounter this issue in future, the default code snippet provided by google is for html integration. If you are loading js script externally, remember to get rid of the html tags!

2 Likes