templates/front/_tracking_ga_ads.html.twig line 1

Open in your IDE?
  1. {# ===================================================== #}
  2. {# GOOGLE ANALYTICS + ADS ------------------------------ #}
  3. {# ===================================================== #}
  4. {% if tracking_tools.GOOGLE_ANALYTICS_ID is defined and tracking_tools.GOOGLE_ANALYTICS_ID is not empty %}
  5. <script async
  6.         src="https://www.googletagmanager.com/gtag/js?id={{ tracking_tools.GOOGLE_ANALYTICS_ID }}"></script>
  7. <script>
  8. window.dataLayer = window.dataLayer || [];
  9. function gtag() {
  10.     dataLayer.push(arguments);
  11. }
  12. gtag('js', new Date());
  13. {# Google Analytics #}
  14. gtag('config', '{{ tracking_tools.GOOGLE_ANALYTICS_ID }}');
  15. {# Google Ads (optionnel) #}
  16. {% if tracking_tools.GOOGLE_ADS_ID is defined and tracking_tools.GOOGLE_ADS_ID is not empty %}
  17. gtag('config', '{{ tracking_tools.GOOGLE_ADS_ID }}');
  18. {% endif %}
  19. </script>
  20. {% endif %}