add google analytics
This commit is contained in:
parent
f72c2ad15e
commit
df92ae2dee
@ -2,6 +2,8 @@
|
||||
# Copy this file to .env file for development, create environment variables when deploying to production
|
||||
# https://symfony.com/doc/current/best_practices/configuration.html#infrastructure-related-configuration
|
||||
|
||||
GOOGLE_ANALYTICS=
|
||||
|
||||
###> symfony/framework-bundle ###
|
||||
APP_ENV=dev
|
||||
APP_SECRET=1bdf86cdc78fba654e4f2c309c6bbdbd
|
||||
|
@ -2,3 +2,5 @@ twig:
|
||||
paths: ['%kernel.project_dir%/templates']
|
||||
debug: '%kernel.debug%'
|
||||
strict_variables: '%kernel.debug%'
|
||||
globals:
|
||||
ga_tracking: "%env(GOOGLE_ANALYTICS)%"
|
||||
|
@ -19,6 +19,18 @@
|
||||
<meta name="apple-mobile-web-app-capable" content="yes">
|
||||
|
||||
<title>{% block title %}Czy dojadę?{% endblock %}</title>
|
||||
|
||||
{% if ga_tracking %}
|
||||
<!-- Global site tag (gtag.js) - Google Analytics -->
|
||||
<script async src="https://www.googletagmanager.com/gtag/js?id={{ ga_tracking }}"></script>
|
||||
<script>
|
||||
window.dataLayer = window.dataLayer || [];
|
||||
function gtag(){dataLayer.push(arguments);}
|
||||
|
||||
gtag('js', new Date());
|
||||
gtag('config', '{{ ga_tracking }}');
|
||||
</script>
|
||||
{% endif %}
|
||||
</head>
|
||||
<body>
|
||||
<main role="main" class="container not-ready" id="app">
|
||||
|
Loading…
Reference in New Issue
Block a user