|
21 | 21 |
|
22 | 22 | {# google analytics #} |
23 | 23 | {% if podspec.meta.google_analytics_id %} |
| 24 | + <script async src="https://www.googletagmanager.com/gtag/js?id={{ podspec.meta.google_analytics_id }}"></script> |
24 | 25 | <script> |
25 | | - (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){ |
26 | | - (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o), |
27 | | - m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m) |
28 | | - })(window,document,'script','//www.google-analytics.com/analytics.js','ga'); |
29 | | - ga('create', '{{ podspec.meta.google_analytics_id }}', 'auto'); |
30 | | - ga('require', 'eventTracker', { |
31 | | - events: ['click', 'auxclick', 'contextmenu'], |
32 | | - hitFilter: function(model, element, event){ |
33 | | - model.set('eventAction', event.type, true) |
34 | | - } |
35 | | - }); |
36 | | - ga('send', 'pageview'); |
| 26 | + window.dataLayer = window.dataLayer || []; |
| 27 | + function gtag(){dataLayer.push(arguments);} |
| 28 | + gtag('js', new Date()); |
| 29 | + |
| 30 | + gtag('config', '{{ podspec.meta.google_analytics_id }}'); |
37 | 31 | </script> |
38 | 32 | {% endif %} |
39 | 33 | {# styles and links #} |
|
0 commit comments