aboutsummaryrefslogblamecommitdiffstats
path: root/pelican-bootstrap3/templates/includes/ga.html
blob: c0c3425dfb6f5e3c01c6b4d9568e1754fe3c39d0 (plain) (tree)
1
2
3
4
5
6
7
8
9
                         
                             




                                                                                                    
 
                                               

                                      






                                                                                      







                                                                                       
 

                                                                                                      
             
                                                
          
{% if GOOGLE_ANALYTICS %}
    <!-- Google Analytics -->
    <script async src="https://www.googletagmanager.com/gtag/js?id={{ GOOGLE_ANALYTICS }}"></script>
    <script>
        window.dataLayer = window.dataLayer || [];
        function gtag(){dataLayer.push(arguments);}
        gtag('js', new Date());

        gtag('config', {{ GOOGLE_ANALYTICS }});
    </script>
    <!-- End Google Analytics Code -->
    <!-- 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','{{ GA_GTM_CONTAINER_ID }}');</script>
    <!-- End Google Tag Manager -->
{% endif %}
{% if GOOGLE_ANALYTICS_UNIVERSAL %}
    <!-- Google Analytics Universal -->
    <script type="text/javascript">
        (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','//www.google-analytics.com/analytics.js','ga');

        ga('create', '{{ GOOGLE_ANALYTICS_UNIVERSAL }}', '{{ GOOGLE_ANALYTICS_UNIVERSAL_PROPERTY }}');
        ga('send', 'pageview');
    </script>
    <!-- End Google Analytics Universal Code -->
{% endif %}