-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
4133a2c
commit de9717b
Showing
1 changed file
with
90 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,35 +1,96 @@ | ||
{# --- Google old style --- #} | ||
{% if data.global.analyticsType == 'google-analytics-old-style' %} | ||
{% if data.cookieConsent %} | ||
{# --- Google old style --- #} {% if data.global.analyticsType == | ||
'google-analytics-old-style' %} {% if data.cookieConsent %} | ||
<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'); | ||
(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', '{{data.global.analyticsIdentifier}}', 'auto'); | ||
ga('send', 'pageview'); | ||
ga('create', '{{data.global.analyticsIdentifier}}', 'auto'); | ||
ga('send', 'pageview'); | ||
</script> | ||
{% endif %} | ||
{% endif %} | ||
|
||
{# --- Google new style --- #} | ||
{% if data.global.analyticsType == 'google-analytics-new-style' %} | ||
{% if data.cookieConsent %} | ||
<script async src="https://www.googletagmanager.com/gtag/js?id={{data.global.analyticsIdentifier}}"></script> | ||
{% endif %} {% endif %} {# --- Google new style --- #} {% if | ||
data.global.analyticsType == 'google-analytics-new-style' %} {% if | ||
data.cookieConsent %} | ||
<script | ||
async | ||
src="https://www.googletagmanager.com/gtag/js?id={{data.global.analyticsIdentifier}}" | ||
></script> | ||
<script> | ||
window.dataLayer = window.dataLayer || []; | ||
function gtag(){dataLayer.push(arguments);} | ||
gtag('js', new Date()); | ||
gtag('config', '{{data.global.analyticsIdentifier}}'); | ||
window.dataLayer = window.dataLayer || []; | ||
function gtag() { | ||
dataLayer.push(arguments); | ||
} | ||
gtag('js', new Date()); | ||
gtag('config', '{{data.global.analyticsIdentifier}}'); | ||
</script> | ||
{% endif %} | ||
{% endif %} | ||
|
||
{# --- Custom code --- #} | ||
{% if data.global.analyticsType == 'custom' %} | ||
{% if data.cookieConsent %} | ||
{{data.global.analyticsCodeBlock | safe}} | ||
{% endif %} | ||
{% endif %} | ||
{% endif %} {% endif %} {# --- Custom code --- #} {% if | ||
data.global.analyticsType == 'custom' %} {% if data.cookieConsent %} | ||
{{data.global.analyticsCodeBlock | safe}} {% endif %} {% endif %} | ||
|
||
<script type="text/javascript"> | ||
(function (window, document, dataLayerName, id) { | ||
(window[dataLayerName] = window[dataLayerName] || []), | ||
window[dataLayerName].push({ | ||
start: new Date().getTime(), | ||
event: 'stg.start', | ||
}); | ||
var scripts = document.getElementsByTagName('script')[0], | ||
tags = document.createElement('script'); | ||
function stgCreateCookie(a, b, c) { | ||
var d = ''; | ||
if (c) { | ||
var e = new Date(); | ||
e.setTime(e.getTime() + 24 * c * 60 * 60 * 1e3), | ||
(d = '; expires=' + e.toUTCString()); | ||
} | ||
document.cookie = a + '=' + b + d + '; path=/'; | ||
} | ||
var isStgDebug = | ||
(window.location.href.match('stg_debug') || | ||
document.cookie.match('stg_debug')) && | ||
!window.location.href.match('stg_disable_debug'); | ||
stgCreateCookie('stg_debug', isStgDebug ? 1 : '', isStgDebug ? 14 : -1); | ||
var qP = []; | ||
dataLayerName !== 'dataLayer' && | ||
qP.push('data_layer_name=' + dataLayerName), | ||
isStgDebug && qP.push('stg_debug'); | ||
var qPString = qP.length > 0 ? '?' + qP.join('&') : ''; | ||
(tags.async = !0), | ||
(tags.src = | ||
'https://dap.amsterdam.nl/containers/' + id + '.js' + qPString), | ||
scripts.parentNode.insertBefore(tags, scripts); | ||
!(function (a, n, i) { | ||
a[n] = a[n] || {}; | ||
for (var c = 0; c < i.length; c++) | ||
!(function (i) { | ||
(a[n][i] = a[n][i] || {}), | ||
(a[n][i].api = | ||
a[n][i].api || | ||
function () { | ||
var a = [].slice.call(arguments, 0); | ||
'string' == typeof a[0] && | ||
window[dataLayerName].push({ | ||
event: n + '.' + i + ':' + a[0], | ||
parameters: [].slice.call(arguments, 1), | ||
}); | ||
}); | ||
})(i[c]); | ||
})(window, 'ppms', ['tm', 'cm']); | ||
})(window, document, 'dataLayer', 'e63312c0-0efe-4c4f-bba1-3ca1f05374a8'); | ||
</script> |
de9717b
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Published new image:
openstad/frontend:feature-piwik-integration-de9717b