Google Tag Manager: There is a way to integrate GTM with material-mkdocs #5607
Replies: 4 comments 9 replies
-
Yes, several users already did that successfully. Please try and use the issue/discussion search, as this was asked before. |
Beta Was this translation helpful? Give feedback.
-
This was 🥇 . Thanks all this @normandy7 and @kevinah95 ! |
Beta Was this translation helpful? Give feedback.
-
@squidfunk would you be open to a PR that adds the stock implementation to Material for MkDocs? It's kind of a good first issue, but GTM gets trendy |
Beta Was this translation helpful? Give feedback.
-
Hello! Probably there is someone else who interested in temp solution till fundamental changes will be released.
{% extends "base.html" %}
{% block analytics %}
<!-- Google Tag Manager -->
<script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
})(window,document,'script','dataLayer','GTM-XXXXXXXX');</script>
<!-- End Google Tag Manager -->
{{ super() }}
{% endblock %}
{% block header %}
<!-- Google Tag Manager (noscript) -->
<noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-XXXXXXXX"
height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>
<!-- End Google Tag Manager (noscript) -->
{{ super() }}
{% endblock %} Thank you, @teners for this solution example |
Beta Was this translation helpful? Give feedback.
-
Hello.
I'm trying to finda a way to integrate the GTM from GA4 in my documentation project.
My problem is that I build the project with gitlab runners directly on the server. And for what I saw, you need to add some code in your html pages to getting it work.
There is a way to do this, without building the project first and adding the code lines, before sent it to my server ?
Beta Was this translation helpful? Give feedback.
All reactions