Skip to content

Commit 025c76d

Browse files
authored
Merge pull request #215 from VChapdelaineT/master
2 parents 3c37a38 + dd5df66 commit 025c76d

File tree

2 files changed

+8
-10
lines changed

2 files changed

+8
-10
lines changed

etc/detailed-webserver-instructions.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,12 +73,12 @@ At this point your PheWeb should be working how you want it to, except maybe the
7373

7474
## Using Google Analytics
7575

76-
Go [here](https://analytics.google.com/analytics/web) and do whatever you have to to get your own UA-xxxxxxxx-x tracking id.
76+
Go [here](https://analytics.google.com/analytics/web) and do whatever you have to to get your own tracking id (i.e. AW-XXXXX or G-XXXXX).
7777

7878
Then, in `config.py`, set:
7979

8080
```
81-
GOOGLE_ANALYTICS_TRACKING_ID = 'UA-xxxxxxxx-x'
81+
GOOGLE_ANALYTICS_TRACKING_ID = 'G-XXXXX'
8282
```
8383

8484
and kill and restart `pheweb serve`.

pheweb/serve/templates/layout.html

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -30,14 +30,12 @@
3030
{% endif %}
3131

3232
{% if config['GOOGLE_ANALYTICS_TRACKING_ID'] %}
33-
<script type="text/javascript">
34-
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
35-
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
36-
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
37-
})(window,document,'script','https://www.google-analytics.com/analytics.js','ga');
38-
ga('create', '{{ config['GOOGLE_ANALYTICS_TRACKING_ID'] }}', 'auto');
39-
ga('send', 'pageview');
40-
</script>
33+
<script async src="https://www.googletagmanager.com/gtag/js?id={{config['GOOGLE_ANALYTICS_TRACKING_ID']}}"></script>
34+
<script>
35+
window.dataLayer = window.dataLayer || [];
36+
function gtag(){dataLayer.push(arguments);}
37+
gtag('js', new Date());
38+
gtag('config', "{{config['GOOGLE_ANALYTICS_TRACKING_ID']}}");
4139
{% endif %}
4240
{% block in_head %}{% endblock %}
4341
</head>

0 commit comments

Comments
 (0)