docs: migrate to google tag manager (#4711)

This commit is contained in:
Praveen Durairaju 2020-05-08 13:14:20 +05:30 committed by GitHub
parent f1c3b43f6f
commit 6ffb29b943
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 19 additions and 21 deletions

View File

@ -138,6 +138,13 @@
{%- block scripts %} {%- block scripts %}
{{- script() }} {{- script() }}
{%- endblock %} {%- endblock %}
<!-- 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-PF5MQ2Z');</script>
<!-- End Google Tag Manager -->
{%- if use_opensearch %} {%- if use_opensearch %}
<link rel="search" type="application/opensearchdescription+xml" <link rel="search" type="application/opensearchdescription+xml"
title="{% trans docstitle=docstitle|e %}Search within {{ docstitle }}{% endtrans %}" title="{% trans docstitle=docstitle|e %}Search within {{ docstitle }}{% endtrans %}"
@ -174,6 +181,10 @@
{%- block content %} {%- block content %}
{%- block sidebar1 %} {# possible location for sidebar #} {% endblock %} {%- block sidebar1 %} {# possible location for sidebar #} {% endblock %}
<!-- Google Tag Manager (noscript) -->
<noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-PF5MQ2Z"
height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>
<!-- End Google Tag Manager (noscript) -->
<div class="document"> <div class="document">
{%- block document %} {%- block document %}
<div class="documentwrapper"> <div class="documentwrapper">

View File

@ -168,17 +168,6 @@
{% block sidebar2 %}{% endblock %} {% block sidebar2 %}{% endblock %}
{% block footer %} {% block footer %}
<!-- GA -->
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','https://www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-59768903-1', 'auto');
ga('send', 'pageview');
</script>
<!-- intercom --> <!-- intercom -->
<script> <script>
window.intercomSettings = { window.intercomSettings = {
@ -259,16 +248,14 @@
// Track GA event // Track GA event
const trackga = function ( category, action, label, value ) { const trackga = function ( category, action, label, value ) {
// If ga is available window.dataLayer = window.dataLayer || [];
if ( ga ) { window.dataLayer.push({
ga('send', { event: 'Click Events',
hitType: 'event', category: category,
eventCategory: category, action: action,
eventAction: action, label: label,
eventLabel: label, value: value
eventValue: value })
});
}
}; };
</script> </script>