Advertisement
NikolayBezay

Custom GTM for new Adoric users

Sep 20th, 2021
178
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 1.82 KB | None | 0 0
  1. <script>
  2. //https://adoric.com/experience
  3. (function() {
  4.     var waitPageTriggerElement = setInterval(function() {
  5.         var setExperienceDialogForm = document.querySelector('#setExperienceDialog form');
  6.         if (setExperienceDialogForm) {
  7.             clearInterval(waitPageTriggerElement);
  8.             var userGoal = document.querySelector('select[name="goal"]');
  9.             var userRole = document.querySelector('select[name="role"]');
  10.             setExperienceDialogForm.addEventListener('submit', function() {
  11.               window.localStorage.setItem('adoricRegistrationUserGoal', userGoal.value);
  12.               window.localStorage.setItem('adoricRegistrationUserRole', userRole.value);
  13.             });
  14.         }
  15.     }, 500);
  16.     setTimeout(function() {
  17.         clearInterval(waitPageTriggerElement);
  18.     }, 7000);
  19. })();    
  20. </script>
  21.  
  22.  
  23. <script>
  24. //https://adoric.com/editDomain
  25. (function() {
  26.     var waitPageTriggerElement = setInterval(function() {
  27.         var domainNameCreateForm = document.querySelector('#domainNameCreate');
  28.         if (domainNameCreateForm) {
  29.             clearInterval(waitPageTriggerElement);
  30.             var userDomain = document.querySelector('INPUT[name="domain"]');
  31.             var userDomainIndustry = document.querySelector('select[name="domainIndustry"]');
  32.             var nextPageButton = document.querySelector('#domainNameCreate INPUT[data-test-id="nextStep"]');
  33.             nextPageButton.addEventListener('click', function() {
  34.               window.localStorage.setItem('adoricRegistrationUserDomain', userDomain.value);
  35.               window.localStorage.setItem('adoricRegistrationUserDomainIndustry', userDomainIndustry.value);
  36.             });
  37.         }
  38.     }, 500);
  39.     setTimeout(function() {
  40.         clearInterval(waitPageTriggerElement);
  41.     }, 7000);
  42. })();    
  43. </script>
  44.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement