diff options
author | Struan Donald <struan@exo.org.uk> | 2014-04-16 14:36:54 +0100 |
---|---|---|
committer | Struan Donald <struan@exo.org.uk> | 2014-04-16 16:00:47 +0100 |
commit | 0625dbe113dc88fe707ca1fb036bf0a580781e15 (patch) | |
tree | 756e83df645c5d5db3f1e9e09f570721e6fad325 /templates | |
parent | 4734b4c74e203928c599828d9a4fff6dbd57c38c (diff) |
alter pave url sent to analytics on report completion
In order to allow us to do funnel analysis in google analytics we need
to send a differnt page url when a user completes a report. To do this
we add a report_created=1 to the query string on either the report page
or the report confirmation page for logged in and confirm by email users
respectively.
There's a bit of complication as we don't want to set a session cookie
everywhere as that will break caching so we set a stash variable,
although if the user is logged in this is controlled by a variable in
the flash as there is already a session cookie at this point.
also, removes the code that sends an event upon report completion as
this was no use for funnel analysis.
Diffstat (limited to 'templates')
-rw-r--r-- | templates/web/default/report/extra_analytics.html | 0 | ||||
-rw-r--r-- | templates/web/default/tokens/confirm_problem.html | 1 | ||||
-rw-r--r-- | templates/web/fixmystreet/report/display.html | 1 | ||||
-rw-r--r-- | templates/web/fixmystreet/report/extra_analytics.html | 8 | ||||
-rw-r--r-- | templates/web/fixmystreet/tracking_code.html | 12 |
5 files changed, 12 insertions, 10 deletions
diff --git a/templates/web/default/report/extra_analytics.html b/templates/web/default/report/extra_analytics.html deleted file mode 100644 index e69de29bb..000000000 --- a/templates/web/default/report/extra_analytics.html +++ /dev/null diff --git a/templates/web/default/tokens/confirm_problem.html b/templates/web/default/tokens/confirm_problem.html index 51b459925..723d515e1 100644 --- a/templates/web/default/tokens/confirm_problem.html +++ b/templates/web/default/tokens/confirm_problem.html @@ -28,5 +28,4 @@ You can <a href="[% c.cobrand.base_url_for_report( problem ) %][% problem.url %] [% display_crosssell_advert( problem.user.email, problem.name ) %] -[% INCLUDE 'report/extra_analytics.html' %] [% INCLUDE 'footer.html' %] diff --git a/templates/web/fixmystreet/report/display.html b/templates/web/fixmystreet/report/display.html index 2c65ca104..b75ef92bc 100644 --- a/templates/web/fixmystreet/report/display.html +++ b/templates/web/fixmystreet/report/display.html @@ -23,7 +23,6 @@ [% INCLUDE 'report/banner.html' %] [% INCLUDE 'report/_main.html' %] -[% INCLUDE 'report/extra_analytics.html' %] [% TRY %][% INCLUDE 'report/_message_manager.html' %][% CATCH file %][% END %] <div class="shadow-wrap"> diff --git a/templates/web/fixmystreet/report/extra_analytics.html b/templates/web/fixmystreet/report/extra_analytics.html deleted file mode 100644 index 4a993cc2d..000000000 --- a/templates/web/fixmystreet/report/extra_analytics.html +++ /dev/null @@ -1,8 +0,0 @@ -[% IF c.flash.created_report %] -<script type="text/javascript"> - var cobrand = $('meta[name="cobrand"]').attr('content'); - if ( typeof ga !== 'undefined' && cobrand == 'fixmystreet' ) { - ga('send', 'event', 'report', 'completed', '[% c.flash.created_report %]' ); - } -</script> -[% END %] diff --git a/templates/web/fixmystreet/tracking_code.html b/templates/web/fixmystreet/tracking_code.html index a9412d4f2..9d8c00d3c 100644 --- a/templates/web/fixmystreet/tracking_code.html +++ b/templates/web/fixmystreet/tracking_code.html @@ -7,6 +7,18 @@ m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m) ga('create', 'UA-660910-4', {'cookieDomain': '.fixmystreet.com'}); ga('set', 'anonymizeIp', true); +[% IF created_report %] +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); +}); +[% END %] ga('send', 'pageview'); </script> |