From d87a2928eca42dcc1f47d3967273d3656e176b53 Mon Sep 17 00:00:00 2001 From: mattf Date: Mon, 10 Jul 2017 22:09:36 +0000 Subject: [PATCH] Added URL logging of Agent Screen Webform button clicks and URLs git-svn-id: svn://192.168.202.10@2788 3d104415-ff17-0410-8863-d5cf3c621b8a --- agc_2-X/trunk/UPGRADE | 2 + agc_2-X/trunk/www/agc/vdc_db_query.php | 22 ++++ agc_2-X/trunk/www/agc/vicidial.php | 111 ++++++++++++++---- .../trunk/www/vicidial/AST_url_log_report.php | 3 +- 4 files changed, 114 insertions(+), 24 deletions(-) diff --git a/agc_2-X/trunk/UPGRADE b/agc_2-X/trunk/UPGRADE index 8e5a7761..2c1cae2e 100644 --- a/agc_2-X/trunk/UPGRADE +++ b/agc_2-X/trunk/UPGRADE @@ -177,6 +177,8 @@ OTHER CHANGES: 40. Added logging and notification of 3-way call hung up in agent screen. +41. Added URL logging of Agent Screen Webform button clicks and URLs + diff --git a/agc_2-X/trunk/www/agc/vdc_db_query.php b/agc_2-X/trunk/www/agc/vdc_db_query.php index ea2b2df9..ea1c1caf 100644 --- a/agc_2-X/trunk/www/agc/vdc_db_query.php +++ b/agc_2-X/trunk/www/agc/vdc_db_query.php @@ -717,6 +717,8 @@ if (isset($_GET["previous_agent_log_id"])) {$previous_agent_log_id=$_GET["previo elseif (isset($_POST["previous_agent_log_id"])) {$previous_agent_log_id=$_POST["previous_agent_log_id"];} if (isset($_GET["last_VDRP_stage"])) {$last_VDRP_stage=$_GET["last_VDRP_stage"];} elseif (isset($_POST["last_VDRP_stage"])) {$last_VDRP_stage=$_POST["last_VDRP_stage"];} +if (isset($_GET["url_link"])) {$url_link=$_GET["url_link"];} + elseif (isset($_POST["url_link"])) {$url_link=$_POST["url_link"];} header ("Content-type: text/html; charset=utf-8"); @@ -1039,6 +1041,7 @@ $usegroupalias = preg_replace('/[^0-9]/','',$usegroupalias); $user_abb = preg_replace("/\'|\"|\\\\|;/","",$user_abb); $vtiger_callback_id = preg_replace("/\'|\"|\\\\|;/","",$vtiger_callback_id); $wrapup = preg_replace("/\'|\"|\\\\|;/","",$wrapup); +$url_link = preg_replace("/\'|\"|\\\\|;/","",$url_link); # default optional vars if not set @@ -15863,6 +15866,25 @@ if ($ACTION == 'Clear_API_Field') } +################################################################################ +### Log_Webform_Click - Logs the URL of a webform that has been clicked on or opened +################################################################################ +if ($ACTION == 'Log_Webform_Click') + { + ### insert a new url log entry + $SQL_log = "$url_link"; + $SQL_log = preg_replace('/;/','',$SQL_log); + $SQL_log = addslashes($SQL_log); + $stmt = "INSERT INTO vicidial_url_log SET uniqueid='$uniqueid',url_date='$NOW_TIME',url_type='webform',url='$SQL_log',url_response='$stage $lead_id';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_to_mysqli($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00XXX',$user,$server_ip,$session_name,$one_mysql_log);} + $affected_rows = mysqli_affected_rows($link); + + echo _QXZ("Webform Click Logged:")." $stage $lead_id"; + } + + diff --git a/agc_2-X/trunk/www/agc/vicidial.php b/agc_2-X/trunk/www/agc/vicidial.php index d731836f..1f2aab48 100644 --- a/agc_2-X/trunk/www/agc/vicidial.php +++ b/agc_2-X/trunk/www/agc/vicidial.php @@ -558,10 +558,11 @@ # 170609-1711 - Added 'commit' function to force immediate submission of Customer Information changes to database # 170629-1831 - Added some new agent_events entries # 170709-1116 - Added Xfer Hung Up notification +# 170710-1802 - Added logging of clicks on webform buttons # -$version = '2.14-528c'; -$build = '170709-1116'; +$version = '2.14-529c'; +$build = '170710-1802'; $mel=1; # Mysql Error Log enabled = 1 $mysql_log_count=87; $one_mysql_log=0; @@ -7929,16 +7930,16 @@ function set_length(SLnumber,SLlength_goal,SLdirection) TEMP_VDIC_web_form_address_three = URLDecode(VDIC_web_form_address_three,'YES','DEFAULT','3'); } - document.getElementById("WebFormSpan").innerHTML = "\" border=\"0\" alt=\"Web Form\" />\n"; + document.getElementById("WebFormSpan").innerHTML = "\" border=\"0\" alt=\"Web Form\" />\n"; if (enable_second_webform > 0) { - document.getElementById("WebFormSpanTwo").innerHTML = "\" border=\"0\" alt=\"Web Form 2\" />\n"; + document.getElementById("WebFormSpanTwo").innerHTML = "\" border=\"0\" alt=\"Web Form 2\" />\n"; } if (enable_third_webform > 0) { - document.getElementById("WebFormSpanThree").innerHTML = "\" border=\"0\" alt=\"Web Form 3\" />\n"; + document.getElementById("WebFormSpanThree").innerHTML = "\" border=\"0\" alt=\"Web Form 3\" />\n"; } if (CalL_ScripT_color.length > 1) @@ -7979,14 +7980,17 @@ function set_length(SLnumber,SLlength_goal,SLdirection) if (CalL_AutO_LauncH == 'WEBFORM') { window.open(TEMP_VDIC_web_form_address, web_form_target, 'toolbar=1,scrollbars=1,location=1,statusbar=1,menubar=1,resizable=1,width=640,height=450'); + webform_click_log('Awebform1'); } if (CalL_AutO_LauncH == 'WEBFORMTWO') { window.open(TEMP_VDIC_web_form_address_two, web_form_target, 'toolbar=1,scrollbars=1,location=1,statusbar=1,menubar=1,resizable=1,width=640,height=450'); + webform_click_log('Awebform2'); } if (CalL_AutO_LauncH == 'WEBFORMTHREE') { window.open(TEMP_VDIC_web_form_address_three, web_form_target, 'toolbar=1,scrollbars=1,location=1,statusbar=1,menubar=1,resizable=1,width=640,height=450'); + webform_click_log('Awebform3'); } api_switch_lead_triggered=0; @@ -8747,14 +8751,14 @@ function set_length(SLnumber,SLlength_goal,SLdirection) TEMP_VDIC_web_form_address_three = URLDecode(VDIC_web_form_address_three,'YES','DEFAULT','3'); } - document.getElementById("WebFormSpan").innerHTML = "\" border=\"0\" alt=\"Web Form\" />\n"; + document.getElementById("WebFormSpan").innerHTML = "\" border=\"0\" alt=\"Web Form\" />\n"; if (enable_second_webform > 0) { - document.getElementById("WebFormSpanTwo").innerHTML = "\" border=\"0\" alt=\"Web Form 2\" />\n"; + document.getElementById("WebFormSpanTwo").innerHTML = "\" border=\"0\" alt=\"Web Form 2\" />\n"; } if (enable_third_webform > 0) { - document.getElementById("WebFormSpanTwo").innerHTML = "\" border=\"0\" alt=\"Web Form 3\" />\n"; + document.getElementById("WebFormSpanTwo").innerHTML = "\" border=\"0\" alt=\"Web Form 3\" />\n"; } agent_events('update_fields', event_data); @@ -9276,14 +9280,14 @@ function set_length(SLnumber,SLlength_goal,SLdirection) TEMP_VDIC_web_form_address_three = URLDecode(VDIC_web_form_address_three,'YES','DEFAULT','3'); } - document.getElementById("WebFormSpan").innerHTML = "\" border=\"0\" alt=\"Web Form\" />\n"; + document.getElementById("WebFormSpan").innerHTML = "\" border=\"0\" alt=\"Web Form\" />\n"; if (enable_second_webform > 0) { - document.getElementById("WebFormSpanTwo").innerHTML = "\" border=\"0\" alt=\"Web Form 2\" />\n"; + document.getElementById("WebFormSpanTwo").innerHTML = "\" border=\"0\" alt=\"Web Form 2\" />\n"; } if (enable_third_webform > 0) { - document.getElementById("WebFormSpanThree").innerHTML = "\" border=\"0\" alt=\"Web Form 3\" />\n"; + document.getElementById("WebFormSpanThree").innerHTML = "\" border=\"0\" alt=\"Web Form 3\" />\n"; } if (CBentry_time.length > 2) @@ -9377,14 +9381,17 @@ function set_length(SLnumber,SLlength_goal,SLdirection) if (get_call_launch == 'WEBFORM') { window.open(TEMP_VDIC_web_form_address, web_form_target, 'toolbar=1,scrollbars=1,location=1,statusbar=1,menubar=1,resizable=1,width=640,height=450'); + webform_click_log('Awebform1'); } if (get_call_launch == 'WEBFORMTWO') { window.open(TEMP_VDIC_web_form_address_two, web_form_target, 'toolbar=1,scrollbars=1,location=1,statusbar=1,menubar=1,resizable=1,width=640,height=450'); + webform_click_log('Awebform2'); } if (get_call_launch == 'WEBFORMTHREE') { window.open(TEMP_VDIC_web_form_address_three, web_form_target, 'toolbar=1,scrollbars=1,location=1,statusbar=1,menubar=1,resizable=1,width=640,height=450'); + webform_click_log('Awebform3'); } } else @@ -9810,14 +9817,17 @@ function set_length(SLnumber,SLlength_goal,SLdirection) if (get_call_launch == 'WEBFORM') { window.open(TEMP_VDIC_web_form_address, web_form_target, 'toolbar=1,scrollbars=1,location=1,statusbar=1,menubar=1,resizable=1,width=640,height=450'); + webform_click_log('Awebform1'); } if (get_call_launch == 'WEBFORMTWO') { window.open(TEMP_VDIC_web_form_address_two, web_form_target, 'toolbar=1,scrollbars=1,location=1,statusbar=1,menubar=1,resizable=1,width=640,height=450'); + webform_click_log('Awebform2'); } if (get_call_launch == 'WEBFORMTHREE') { window.open(TEMP_VDIC_web_form_address_three, web_form_target, 'toolbar=1,scrollbars=1,location=1,statusbar=1,menubar=1,resizable=1,width=640,height=450'); + webform_click_log('Awebform3'); } } } @@ -10758,16 +10768,16 @@ function set_length(SLnumber,SLlength_goal,SLdirection) } - document.getElementById("WebFormSpan").innerHTML = "\" border=\"0\" alt=\"Web Form\" />\n"; + document.getElementById("WebFormSpan").innerHTML = "\" border=\"0\" alt=\"Web Form\" />\n"; if (enable_second_webform > 0) { - document.getElementById("WebFormSpanTwo").innerHTML = "\" border=\"0\" alt=\"Web Form 2\" />\n"; + document.getElementById("WebFormSpanTwo").innerHTML = "\" border=\"0\" alt=\"Web Form 2\" />\n"; } if (enable_third_webform > 0) { - document.getElementById("WebFormSpanThree").innerHTML = "\" border=\"0\" alt=\"Web Form 3\" />\n"; + document.getElementById("WebFormSpanThree").innerHTML = "\" border=\"0\" alt=\"Web Form 3\" />\n"; } if ( (LIVE_campaign_recording == 'ALLCALLS') || (LIVE_campaign_recording == 'ALLFORCE') ) @@ -10823,14 +10833,17 @@ function set_length(SLnumber,SLlength_goal,SLdirection) if (CalL_AutO_LauncH == 'WEBFORM') { window.open(TEMP_VDIC_web_form_address, web_form_target, 'toolbar=1,scrollbars=1,location=1,statusbar=1,menubar=1,resizable=1,width=640,height=450'); + webform_click_log('Awebform1'); } if (CalL_AutO_LauncH == 'WEBFORMTWO') { window.open(TEMP_VDIC_web_form_address_two, web_form_target, 'toolbar=1,scrollbars=1,location=1,statusbar=1,menubar=1,resizable=1,width=640,height=450'); + webform_click_log('Awebform2'); } if (CalL_AutO_LauncH == 'WEBFORMTHREE') { window.open(TEMP_VDIC_web_form_address_three, web_form_target, 'toolbar=1,scrollbars=1,location=1,statusbar=1,menubar=1,resizable=1,width=640,height=450'); + webform_click_log('Awebform3'); } if (useIE > 0) @@ -11499,15 +11512,15 @@ function set_length(SLnumber,SLlength_goal,SLdirection) } - document.getElementById("WebFormSpan").innerHTML = "\" border=\"0\" alt=\"Web Form\" />\n"; + document.getElementById("WebFormSpan").innerHTML = "\" border=\"0\" alt=\"Web Form\" />\n"; if (enable_second_webform > 0) { - document.getElementById("WebFormSpanTwo").innerHTML = "\" border=\"0\" alt=\"Web Form 2\" />\n"; + document.getElementById("WebFormSpanTwo").innerHTML = "\" border=\"0\" alt=\"Web Form 2\" />\n"; } if (enable_third_webform > 0) { - document.getElementById("WebFormSpanThree").innerHTML = "\" border=\"0\" alt=\"Web Form 3\" />\n"; + document.getElementById("WebFormSpanThree").innerHTML = "\" border=\"0\" alt=\"Web Form 3\" />\n"; } if ( (LIVE_campaign_recording == 'ALLCALLS') || (LIVE_campaign_recording == 'ALLFORCE') ) @@ -11569,14 +11582,17 @@ function set_length(SLnumber,SLlength_goal,SLdirection) if (CalL_AutO_LauncH == 'WEBFORM') { window.open(TEMP_VDIC_web_form_address, web_form_target, 'toolbar=1,scrollbars=1,location=1,statusbar=1,menubar=1,resizable=1,width=640,height=450'); + webform_click_log('Awebform1'); } if (CalL_AutO_LauncH == 'WEBFORMTWO') { window.open(TEMP_VDIC_web_form_address_two, web_form_target, 'toolbar=1,scrollbars=1,location=1,statusbar=1,menubar=1,resizable=1,width=640,height=450'); + webform_click_log('Awebform2'); } if (CalL_AutO_LauncH == 'WEBFORMTHREE') { window.open(TEMP_VDIC_web_form_address_three, web_form_target, 'toolbar=1,scrollbars=1,location=1,statusbar=1,menubar=1,resizable=1,width=640,height=450'); + webform_click_log('Awebform3'); } if (useIE > 0) @@ -11669,11 +11685,11 @@ function set_length(SLnumber,SLlength_goal,SLdirection) if (taskrefresh == 'OUT') { - document.getElementById("WebFormSpan").innerHTML = "\" border=\"0\" alt=\"Web Form\" />\n"; + document.getElementById("WebFormSpan").innerHTML = "\" border=\"0\" alt=\"Web Form\" />\n"; } else { - document.getElementById("WebFormSpan").innerHTML = "\" border=\"0\" alt=\"Web Form\" />\n"; + document.getElementById("WebFormSpan").innerHTML = "\" border=\"0\" alt=\"Web Form\" />\n"; } } @@ -11713,11 +11729,11 @@ function set_length(SLnumber,SLlength_goal,SLdirection) { if (taskrefresh == 'OUT') { - document.getElementById("WebFormSpanTwo").innerHTML = "\" border=\"0\" alt=\"Web Form 2\" />\n"; + document.getElementById("WebFormSpanTwo").innerHTML = "\" border=\"0\" alt=\"Web Form 2\" />\n"; } else { - document.getElementById("WebFormSpanTwo").innerHTML = "\" border=\"0\" alt=\"Web Form 2\" />\n"; + document.getElementById("WebFormSpanTwo").innerHTML = "\" border=\"0\" alt=\"Web Form 2\" />\n"; } } } @@ -11758,11 +11774,11 @@ function set_length(SLnumber,SLlength_goal,SLdirection) { if (taskrefresh == 'OUT') { - document.getElementById("WebFormSpanThree").innerHTML = "\" border=\"0\" alt=\"Web Form 3\" />\n"; + document.getElementById("WebFormSpanThree").innerHTML = "\" border=\"0\" alt=\"Web Form 3\" />\n"; } else { - document.getElementById("WebFormSpanThree").innerHTML = "\" border=\"0\" alt=\"Web Form 3\" />\n"; + document.getElementById("WebFormSpanThree").innerHTML = "\" border=\"0\" alt=\"Web Form 3\" />\n"; } } } @@ -16160,6 +16176,52 @@ function phone_number_format(formatphone) { } +// ################################################################################ +// Run the logging process for webform clicks + function webform_click_log(temp_trigger) + { + if ( (temp_trigger == 'webform1') || (temp_trigger == 'Awebform1') || (temp_trigger == 'Twebform1') ) {temp_url = TEMP_VDIC_web_form_address;} + if ( (temp_trigger == 'webform2') || (temp_trigger == 'Awebform2') || (temp_trigger == 'Twebform2') ) {temp_url = TEMP_VDIC_web_form_address_two;} + if ( (temp_trigger == 'webform3') || (temp_trigger == 'Awebform3') || (temp_trigger == 'Twebform3') ) {temp_url = TEMP_VDIC_web_form_address_three;} + enc_temp_url = encodeURIComponent(temp_url); + var xmlhttp=false; + /*@cc_on @*/ + /*@if (@_jscript_version >= 5) + // JScript gives us Conditional compilation, we can cope with old IE versions. + // and security blocked creation of the objects. + try { + xmlhttp = new ActiveXObject("Msxml2.XMLHTTP"); + } catch (e) { + try { + xmlhttp = new ActiveXObject("Microsoft.XMLHTTP"); + } catch (E) { + xmlhttp = false; + } + } + @end @*/ + if (!xmlhttp && typeof XMLHttpRequest!='undefined') + { + xmlhttp = new XMLHttpRequest(); + } + if (xmlhttp) + { + WFCL_query = "server_ip=" + server_ip + "&session_name=" + session_name + "&stage=" + temp_trigger + "&lead_id=" + document.vicidial_form.lead_id.value + "&ACTION=Log_Webform_Click&format=text&user=" + user + "&pass=" + pass + "&url_link=" + enc_temp_url; + xmlhttp.open('POST', 'vdc_db_query.php'); + xmlhttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded; charset=UTF-8'); + xmlhttp.send(WFCL_query); + xmlhttp.onreadystatechange = function() + { + if (xmlhttp.readyState == 4 && xmlhttp.status == 200) + { + // alert(xmlhttp.responseText); + // document.getElementById("debugbottomspan").innerHTML = "WEBFORM LOG " + xmlhttp.responseText; + } + } + delete xmlhttp; + } + } + + // ################################################################################ // Run the Agent Push Events process function agent_events(event_type,event_msg) @@ -16619,16 +16681,19 @@ function phone_number_format(formatphone) { { WebFormRefresH('NO','YES'); window.open(TEMP_VDIC_web_form_address, web_form_target, 'toolbar=1,scrollbars=1,location=1,statusbar=1,menubar=1,resizable=1,width=640,height=450'); + webform_click_log('Twebform1'); } if (timer_action == 'WEBFORM2') { WebFormTwoRefresH('NO','YES'); window.open(TEMP_VDIC_web_form_address_two, web_form_target, 'toolbar=1,scrollbars=1,location=1,statusbar=1,menubar=1,resizable=1,width=640,height=450'); + webform_click_log('Twebform2'); } if (timer_action == 'WEBFORM3') { WebFormThreeRefresH('NO','YES'); window.open(TEMP_VDIC_web_form_address_three, web_form_target, 'toolbar=1,scrollbars=1,location=1,statusbar=1,menubar=1,resizable=1,width=640,height=450'); + webform_click_log('Twebform3'); } if (timer_action == 'D1_DIAL') { diff --git a/agc_2-X/trunk/www/vicidial/AST_url_log_report.php b/agc_2-X/trunk/www/vicidial/AST_url_log_report.php index bc803e49..0d4263e2 100644 --- a/agc_2-X/trunk/www/vicidial/AST_url_log_report.php +++ b/agc_2-X/trunk/www/vicidial/AST_url_log_report.php @@ -11,6 +11,7 @@ # 141230-1415 - Added code for on-the-fly language translations display # 151211-0950 - Added missing url types # 170409-1536 - Added IP List validation code +# 170710-1801 - Added webform url type # $startMS = microtime(); @@ -218,7 +219,7 @@ while($i < $url_type_ct) $i++; } -$LISTurltypes=array("add_lead", "custom", "dispo", "na_callurl", "non-agent", "other", "qm_socket", "start", "start_ra","nva_phone","DID_FILTER","park_ivr_c"); +$LISTurltypes=array("add_lead", "custom", "dispo", "na_callurl", "non-agent", "other", "qm_socket", "start", "start_ra","nva_phone","DID_FILTER","park_ivr_c","webform"); $url_types_to_print=count($LISTurltypes); $i=0;