Sha256: 0ad6e94ca67bf3f98a97751ec9e1f04e7a4cbc598ed962c398a341b03665e570

Contents?: true

Size: 1.46 KB

Versions: 17

Compression:

Stored size: 1.46 KB

Contents

{% if site.google_analytics %}
  <script>!function(w, d) {
    w.ga=w.ga||function(){(ga.q=ga.q||[]).push(arguments)};ga.l=+new Date;

    /*{% if site.hydejack.cookies_banner %}*/
      if (navigator.CookiesOK) {
        ga('create', '{{ site.google_analytics }}', 'auto');
      } else if (d.cookie.indexOf("hy--cookies-ok=true") > -1) {
        ga('create', '{{ site.google_analytics }}', {
          'storage': 'none',
          'clientId': localStorage ? localStorage.getItem('ga--client-id') : undefined
        });
      } else {
        ga('create', '{{ site.google_analytics }}', {
          'storage': 'none'
        });
        ga('set', 'forceSSL', true);
        ga('set', 'anonymizeIp', true);
      }
    /*{% else %}*/
      ga('create', '{{ site.google_analytics }}', 'auto');
    /*{% endif %}*/

    var pushStateEl = d.getElementById('_pushState');
    var timeoutId;
    pushStateEl.addEventListener('hy-push-state-load', function() {
      w.clearTimeout(timeoutId);
      timeoutId = w.setTimeout(function() {
        ga('set', 'page', w.location.pathname);
        ga('send', 'pageview');
      }, 500);
    });

    d.addEventListener('hy--cookies-ok', function () {
      w.ga(function(tracker) {
        w.ga("set", "anonymizeIp", undefined);
        localStorage && localStorage.setItem("ga--client-id", tracker.get("clientId"));
      });
    });

    w.loadJSDeferred('https://www.google-analytics.com/analytics.js');
  }(window, document);</script>
{% endif %}

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
jekyll-theme-hydejack-9.2.1 _includes/body/analytics.html
jekyll-theme-hydejack-9.2.0 _includes/body/analytics.html
jekyll-theme-hydejack-9.1.9 _includes/body/analytics.html
jekyll-theme-hydejack-9.1.8 _includes/body/analytics.html
jekyll-theme-hydejack-9.1.7 _includes/body/analytics.html
jekyll-theme-hydejack-9.1.6 _includes/body/analytics.html
jekyll-theme-hydejack-9.1.5 _includes/body/analytics.html
jekyll-theme-hydejack-9.1.4 _includes/body/analytics.html
jekyll-theme-hydejack-9.1.3 _includes/body/analytics.html
jekyll-theme-hydejack-9.1.2 _includes/body/analytics.html
jekyll-theme-hydejack-9.1.1 _includes/body/analytics.html
jekyll-theme-hydejack-9.1.0 _includes/body/analytics.html
jekyll-theme-hydejack-9.0.4 _includes/body/analytics.html
jekyll-theme-hydejack-9.0.3 _includes/body/analytics.html
jekyll-theme-hydejack-9.0.2 _includes/body/analytics.html
jekyll-theme-hydejack-9.0.1 _includes/body/analytics.html
jekyll-theme-hydejack-9.0.0 _includes/body/analytics.html