Suggest a feature
×

Welcome to TagMyCode

Please login or create account to add a snippet.
0
0
 
0
Language: Javascript
Posted by: user5f44c
Added: May 13, 2020 9:48 AM
Views: 131
Tags: no tags
  1. <script>
  2.   try{
  3. var formSelector = 'form'; // Defaults to first form on the page.
  4.     document.querySelector(formSelector).addEventListener('change', function() {
  5.         window.dataLayer.push({
  6.           'event' : 'formEngagement'
  7.         });                                                    
  8.     });
  9.   }
  10.     catch(err){}  
  11. </script>