Advertisement
NikolayBezay

Nofshonit double integration.

Aug 26th, 2021
198
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 3.79 KB | None | 0 0
  1. <script>
  2.     (function() {
  3.         function getLbIdentifier() {
  4.             var lbData = null;
  5.             adoric.lightboxes.forEach(function(item) {
  6.                 if (item.options.campaignId === self.campaignId) {
  7.                     lbData = item;
  8.                 }
  9.             });
  10.             return lbData;
  11.         }
  12.         var form = document.querySelector('.' + self.identifier + ' [tabindex] form');
  13.         var allCampaignData = getLbIdentifier();
  14.         form.addEventListener('submit', function() {
  15.             var allFormInputs = form.querySelectorAll('INPUT');
  16.             var formData = {};
  17.             for (var i = 0; i < allFormInputs.length; i++) {
  18.                if (allFormInputs[i].getAttribute('name') !== 'sumbit') {
  19.                    fieldName = allFormInputs[i].getAttribute('name');
  20.                    fieldValue = allFormInputs[i].value;
  21.                    formData[fieldName] = fieldValue;
  22.                    console.log(fieldName, '=', fieldValue);
  23.                }
  24.            }
  25.            formData.groupID = '182216';
  26.            var data = {
  27.                subscribe: formData,
  28.                referrer: document.referrer,
  29.                country: sessionStorage.getItem('country_code_cache'),
  30.                action: 'http://www.pulseem.com/Pulseem/PulseemServices.asmx/PostNewClient',
  31.                enctype: '#',
  32.                method: 'GET',
  33.                campaignData: {
  34.                    options: {
  35.                        id: allCampaignData.id,
  36.                        userId: allCampaignData.options.userId,
  37.                        domainId: allCampaignData.statistic.domainId,
  38.                        accountId: allCampaignData.options.userId,
  39.                        campaignTitle: allCampaignData.options.campaignTitle,
  40.                        title: allCampaignData.options.title,
  41.                        type: allCampaignData.options.type
  42.                    }
  43.                }
  44.            };
  45.            var xhr = new XMLHttpRequest();
  46.            xhr.addEventListener('readystatechange', function() {
  47.                if (this.readyState === 4) {
  48.                    console.log('response - ', this.responseText);
  49.                }
  50.            });
  51.            xhr.open('POST', 'https://app.adoric-om.com/v1/forms/webhook');
  52.            xhr.setRequestHeader('cache-control', 'no-cache');
  53.            xhr.send(JSON.stringify(data));
  54.  
  55.             formData.groupID = '467436';
  56.            var data = {
  57.                subscribe: formData,
  58.                referrer: document.referrer,
  59.                country: sessionStorage.getItem('country_code_cache'),
  60.                action: 'http://www.pulseem.com/Pulseem/PulseemServices.asmx/PostNewClient',
  61.                enctype: '#',
  62.                method: 'GET',
  63.                campaignData: {
  64.                    options: {
  65.                        id: allCampaignData.id,
  66.                        userId: allCampaignData.options.userId,
  67.                        domainId: allCampaignData.statistic.domainId,
  68.                        accountId: allCampaignData.options.userId,
  69.                        campaignTitle: allCampaignData.options.campaignTitle,
  70.                        title: allCampaignData.options.title,
  71.                        type: allCampaignData.options.type
  72.                    }
  73.                }
  74.            };
  75.            var xhr = new XMLHttpRequest();
  76.            xhr.addEventListener('readystatechange', function() {
  77.                if (this.readyState === 4) {
  78.                    console.log('response - ', this.responseText);
  79.                }
  80.            });
  81.            xhr.open('POST', 'https://app.adoric-om.com/v1/forms/webhook');
  82.            xhr.setRequestHeader('cache-control', 'no-cache');
  83.            xhr.send(JSON.stringify(data));
  84.  
  85.        });
  86.    })();
  87. </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement