From 837a40ea78b8f438b17ebd50073c606a1ebcb420 Mon Sep 17 00:00:00 2001 From: Bill Erickson Date: Mon, 2 Apr 2018 16:18:31 -0400 Subject: [PATCH] JBAS-2002 Self-reg googalyitcs on submit/cancel events Send events to Goog indicating a submit or cancel button event. Minor cleanup of old commented code. Signed-off-by: Bill Erickson --- KCLS/openils/var/templates_kcls/opac/register.tt2 | 20 ++++++++++++++------ Open-ILS/web/js/ui/default/opac/register.js | 17 +++++++++++++++++ 2 files changed, 31 insertions(+), 6 deletions(-) diff --git a/KCLS/openils/var/templates_kcls/opac/register.tt2 b/KCLS/openils/var/templates_kcls/opac/register.tt2 index 9d3accd312..f9d5f60c67 100644 --- a/KCLS/openils/var/templates_kcls/opac/register.tt2 +++ b/KCLS/openils/var/templates_kcls/opac/register.tt2 @@ -80,11 +80,19 @@ END; # input_field() [% l('[_1]', ctx.page_title) %] - - [% INCLUDE 'opac/parts/goog_analytics.tt2' %] - + + + [%# INCLUDE 'opac/parts/goog_analytics.tt2' %] + + @@ -641,7 +649,7 @@ END; # input_field() value="[% l('Submit Registration') %]"/>
-
diff --git a/Open-ILS/web/js/ui/default/opac/register.js b/Open-ILS/web/js/ui/default/opac/register.js index 99dbb15eee..69edf9010c 100644 --- a/Open-ILS/web/js/ui/default/opac/register.js +++ b/Open-ILS/web/js/ui/default/opac/register.js @@ -242,9 +242,26 @@ function onsub() { alert(msg); return false; } + + if (typeof ga === 'function') { + console.debug('sending GA Submit event'); + ga('send', 'event', 'Full Application', 'submit', 'Forms'); + } + return true; } +function handleCancel(url) { + + if (typeof ga === 'function') { + console.debug('sending GA Cancel event'); + ga('send', 'event', 'Full Application', 'cancel', 'Forms'); + } + + location.href = url; + return false; // avoid form submission +} + function activity_checker_thread() { var start = last_activity.getTime(); var end = new Date().getTime(); -- 2.11.0