Dzhubal

Untitled

Feb 6th, 2020
221
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function dataCollection() {
  2.     if (typeof $ !='undefined') {
  3.         clearInterval(checkJQuery);
  4.         window.myNewFunction = function ($form) {
  5.             var formresult = $form.data('tildaformresult');
  6.             var leadid = formresult.tranid;
  7.             var arr = {};
  8.             $($form.serializeArray()).each(function(i, el) {
  9.                 arr[el.name] = el.value;
  10.             });
  11.             carrotquest.track('Регистрация на бизнес-завтрак', {
  12.                 'Выбранный день': arr['Selectbox']
  13.             });
  14.             carrotquest.identify([
  15.                 {op: 'update_or_create', key: '$name', value: arr["Name"]},
  16.                 {op: 'update_or_create', key: '$phone', value: arr["Phone"]}  
  17.             ]);
  18.         };
  19.      
  20.         $('#form118707469').each(function () {
  21.             $(this).data('success-callback', 'window.myNewFunction');
  22.         });
  23.        
  24.         // регистрация на форум РОСТ
  25.         window.myNewFunction2 = function ($form) {
  26.             var formresult = $form.data('tildaformresult');
  27.             var leadid = formresult.tranid;
  28.             var arr = {};
  29.             $($form.serializeArray()).each(function(i, el) {
  30.                 arr[el.name] = el.value;
  31.             });
  32.             carrotquest.track('Регистрация на форум РОСТ');
  33.             carrotquest.identify([
  34.                 {op: 'update_or_create', key: '$name', value: arr["Name"]},
  35.                 {op: 'update_or_create', key: '$phone', value: arr["Phone"]}  
  36.             ]);
  37.         };
  38.      
  39.         $('#form143111267').each(function () {
  40.             $(this).data('success-callback', 'window.myNewFunction2');
  41.         });
  42.     };
  43. };
  44. var checkJQuery = setInterval(dataCollection, 500);
  45. setTimeout(function() {
  46.     clearInterval(checkJQuery);
  47. }, 5000);
Advertisement
Add Comment
Please, Sign In to add comment