Copybara | 854996b | 2021-09-07 19:36:02 +0000 | [diff] [blame^] | 1 | </div> [# End <div id="maincol"> from header.ezt] |
| 2 | |
| 3 | [include "footer-shared.ezt"] |
| 4 | |
| 5 | <script type="text/javascript" nonce="[nonce]"> |
| 6 | // Google Analytics |
| 7 | (function(i,s,o,g,r,a,m){i[[]'GoogleAnalyticsObject']=r;i[[]r]=i[[]r]||function(){ |
| 8 | (i[[]r].q=i[[]r].q||[[]]).push(arguments)},i[[]r].l=1*new Date();a=s.createElement(o), |
| 9 | m=s.getElementsByTagName(o)[[]0];a.async=1;a.setAttribute('nonce','[nonce]'); |
| 10 | a.src=g;m.parentNode.insertBefore(a,m) |
| 11 | })(window,document,'script','//www.google-analytics.com/analytics.js','ga'); |
| 12 | |
| 13 | (function setupGoogleAnalytics() { |
| 14 | const _EMAIL_REGEX = |
| 15 | ["/([a-zA-Z0-9_\-\.]+)@([a-zA-Z0-9_\-\.]+)\.([a-zA-Z]{2,5})/"]; |
| 16 | |
| 17 | ga('create', '[analytics_id]', {'siteSpeedSampleRate': 100}); |
| 18 | |
| 19 | [if-any logged_in_user] |
| 20 | ga('set', 'dimension1', 'Logged in'); |
| 21 | [else] |
| 22 | ga('set', 'dimension1', 'Not logged in'); |
| 23 | [end] |
| 24 | |
| 25 | const path = window.location.href.slice(window.location.origin.length); |
| 26 | if (path.startsWith('/u')) { |
| 27 | [# Keep anything that looks like an email address out of GA.] |
| 28 | ga('set', 'title', 'A user page'); |
| 29 | ga('set', 'location', path.replace(_EMAIL_REGEX, 'user@example.com')); |
| 30 | } |
| 31 | |
| 32 | ga('send', 'pageview'); |
| 33 | })(); |
| 34 | </script> |
| 35 | |
| 36 | <ezt-app-base [if-any logged_in_user] |
| 37 | userDisplayName="[logged_in_user.email]"[end] |
| 38 | projectName="[projectname]" |
| 39 | ></ezt-app-base> |
| 40 | |
| 41 | </body> |
| 42 | </html> |