Advertisement
AlenaLP

For ROIstat

Mar 26th, 2015
397
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
jQuery 1.34 KB | None | 0 0
  1. <script>
  2.  
  3.     function getCookie(name) {
  4.  
  5.       var matches = document.cookie.match(new RegExp(
  6.  
  7.       "(?:^|; )" + name.replace(/([\.$?*|{}\(\)\[\]\\\/\+^])/g, '\\$1') + "=([^;]*)"
  8.  
  9.       ))
  10.  
  11.       return matches ? decodeURIComponent(matches[1]) : undefined
  12.  
  13.     }  
  14.  
  15.     var roistat = getCookie('roistat_visit');
  16.  
  17.     var roistatMarker = getCookie('roistat_marker');
  18.  
  19.     if (!roistatMarker) {
  20.  
  21.       roistatMarker = 'прямой заход';
  22.  
  23.     }  
  24.  
  25.     jq_144(function($) {
  26.  
  27.       if (window.location.search) {
  28.  
  29.     var paramsStr =
  30.  
  31.     decodeURIComponent(window.location.search.substring(1).replace(/\+/g, ' '));
  32.  
  33.     var params = paramsStr.split('&');
  34.  
  35.     var urlData = {};
  36.    
  37.     for (var i = 0; i < params.length; i++) {
  38.  
  39.         urlData[params[i].split('=')[0]] = params[i].split('=')[1];
  40.     }
  41.     }
  42.  
  43.     $(document).ready(function() {
  44.  
  45.       if (urlData && urlData.lead_id) {
  46.  
  47. $('body').append( '<img src="http://cloud.roistat.com/site-api/0.2/integration/lpgenerator?secret=qwyhdg762ds' +
  48.  
  49. '&projectId=' + '1111' +
  50. '&name=' + urlData.name +
  51. '&email=' + urlData.mail +
  52. '&phone=' + urlData.phone +
  53. '&title=' + 'Новая сделка' +
  54. '&text=' + 'Текст комментария' +
  55. '&Источник=' + roistatMarker +
  56. '&roistat=' + roistat +
  57. '&lead_id=' + urlData.lead_id +
  58. '" width="0" height="0" />' );
  59.       }
  60.     });
  61.     });
  62. </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement