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