PageRenderTime 17ms CodeModel.GetById 9ms app.highlight 5ms RepoModel.GetById 1ms app.codeStats 0ms

/js/wpl.behavorial-tracking.js

https://github.com/deltafactory/leads
JavaScript | 48 lines | 30 code | 7 blank | 11 comment | 8 complexity | 4cc0d117cb3f7e7964ef8796376a4b80 MD5 | raw file
 1/* Was non-conversion-tracking.js */
 2jQuery(document).ready(function($) {
 3	//alert(wplnct.admin_url);
 4
 5	//record non conversion status
 6	var wp_lead_uid = jQuery.cookie("wp_lead_uid");
 7	var wp_lead_id = jQuery.cookie("wp_lead_id");
 8	//var data_block = jQuery.parseJSON(trackObj);
 9	var json = 0;
10	var page_id = wplnct.final_page_id;
11	//console.log(page_id);
12
13// Page view trigging moved to /shared/tracking/page-tracking.js
14
15// Check for Lead lists
16var expired = jQuery.cookie("lead_session_list_check"); // check for session
17if (expired != "true") {
18	//var data_to_lookup = global-localized-vars;
19	if (typeof (wp_lead_id) != "undefined" && wp_lead_id != null && wp_lead_id != "") {
20		jQuery.ajax({
21					type: 'POST',
22					url: wplnct.admin_url,
23					data: {
24						action: 'wpl_check_lists',
25						wp_lead_id: wp_lead_id,
26
27					},
28					success: function(user_id){
29							jQuery.cookie("lead_session_list_check", true, { path: '/', expires: 1 });
30							console.log("Lists checked");
31						   },
32					error: function(MLHttpRequest, textStatus, errorThrown){
33
34						}
35
36				});
37		}
38	}
39/* end list check */
40
41/* Set Expiration Date of Session Logging */
42var e_date = new Date(); // Current date/time
43var e_minutes = 30; // 30 minute timeout to reset sessions
44e_date.setTime(e_date.getTime() + (e_minutes * 60 * 1000)); // Calc 30 minutes from now
45jQuery.cookie("lead_session_expire", false, {expires: e_date, path: '/' }); // Set cookie on page loads
46var expire_time = jQuery.cookie("lead_session_expire"); //
47//console.log(expire_time);
48});