Skip to content

Commit

Permalink
docs: migrate to google tag manager (#4711)
Browse files Browse the repository at this point in the history
  • Loading branch information
praveenweb committed May 8, 2020
1 parent f1c3b43 commit 6ffb29b
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 21 deletions.
11 changes: 11 additions & 0 deletions docs/_theme/djangodocs/basic/layout.html
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,13 @@ <h3>{{ _('Navigation') }}</h3>
{%- block scripts %}
{{- script() }}
{%- 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 %}
<link rel="search" type="application/opensearchdescription+xml"
title="{% trans docstitle=docstitle|e %}Search within {{ docstitle }}{% endtrans %}"
Expand Down Expand Up @@ -174,6 +181,10 @@ <h3>{{ _('Navigation') }}</h3>
{%- block content %}
{%- 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">
{%- block document %}
<div class="documentwrapper">
Expand Down
29 changes: 8 additions & 21 deletions docs/_theme/djangodocs/layout.html
Original file line number Diff line number Diff line change
Expand Up @@ -168,17 +168,6 @@
{% block sidebar2 %}{% endblock %}
{% 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 -->
<script>
window.intercomSettings = {
Expand Down Expand Up @@ -259,16 +248,14 @@

// Track GA event
const trackga = function ( category, action, label, value ) {
// If ga is available
if ( ga ) {
ga('send', {
hitType: 'event',
eventCategory: category,
eventAction: action,
eventLabel: label,
eventValue: value
});
}
window.dataLayer = window.dataLayer || [];
window.dataLayer.push({
event: 'Click Events',
category: category,
action: action,
label: label,
value: value
})
};
</script>

Expand Down

0 comments on commit 6ffb29b

Please sign in to comment.