Advertisement
Guest User

מתוקן

a guest
Oct 26th, 2016
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.22 KB | None | 0 0
  1. <script>
  2. if (document.location.pathname.indexOf('/heb/pages/default.aspx') > -1) {
  3. var target = document.getElementById('MsgThanks');
  4.  
  5. var observer = new MutationObserver(function(mutations) {
  6. mutations.forEach(function(mutation) {
  7. var chkstring = 'style=\"\"';
  8. if (mutation.target.outerHTML.indexOf(chkstring) > -1) {
  9. dataLayer.push({
  10. 'event': 'form-submit'
  11. });
  12. }
  13. console.log(mutation.target.outerHTML);
  14. });
  15. });
  16.  
  17. observer.observe(target, {
  18. attributes: true,
  19. attributeFilter: ['style']
  20. });
  21.  
  22. }
  23. else if(document.location.hostname.indexOf('knowledge') > -1) {
  24. var target = document.querySelector('div.bottom-container');
  25.  
  26. var observer = new MutationObserver(function(mutations) {
  27. mutations.forEach(function(mutation) {
  28. if (mutation.target.outerHTML.indexOf('thankYou') > -1){
  29. dataLayer.push({
  30. 'event': 'form-submit'
  31. });
  32. }
  33. console.log(mutation.target);
  34. });
  35. });
  36.  
  37. var config = {
  38. attributes: true
  39. };
  40.  
  41. observer.observe(target, config);
  42. }
  43. </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement