aboutsummaryrefslogtreecommitdiffstats
path: root/templates/web/fixmystreet.com/tracking_code.html
blob: 3b163f516a07d03f545287b23519ec50d26f444f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
[% IF c.config.BASE_URL == "https://www.fixmystreet.com" %]
<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', 'UA-660910-4', {'cookieDomain': '.fixmystreet.com'});
ga('set', 'anonymizeIp', true);
[% IF created_report %]
ga('require', 'ecommerce');
ga(function(tracker) {
    var page = tracker.get('location');
    var extra = '';
    if ( page.indexOf('?') != -1 ) {
        extra = '&created_report=1';
    } else {
        extra = '?created_report=1';
    }
    tracker.set('location', page + extra);
});
ga('ecommerce:addItem', {
    'id': 'report/[% report.id %]',
    'quantity': '1',
    'name': 'Report'
});
ga('ecommerce:send');
[% END %]
ga('send', 'pageview');

</script>
[% ELSE %]
<!-- Tracking code not inserted as "[% c.config.BASE_URL %]" not "https://www.fixmystreet.com" -->
[% END %]