title: GTM - Exit Intent for scroll - Custom HTML
body: <p>I'm looking for some help with coding a function for exit-intent on my website, but instead of classic function like someone moves a cursor away from website I'd like to implement a fast scroll up as a exit-intent. Is it even possible?</p>
  <p>I found code like this but it doesn't work for me.</p>
  <pre><code>    &lt;script&gt;
  setTimeout(() =&gt; {
  
    document.addEventListener(&quot;scroll&quot;, scrollSpeed);
  
  }, 10000);
  
  
  
  
  
  scrollSpeed = () =&gt; {
  
    lastPosition = window.scrollY;
  
    setTimeout(() =&gt; {
  
      newPosition = window.scrollY;
  
    }, 100);
  
    currentSpeed = newPosition - lastPosition;
  
    console.log(currentSpeed);
  
  
  
    if (currentSpeed &gt; 160) {
  
  userengage('event.exit-intent-mobile');
  
      document.removeEventListener(&quot;scroll&quot;, scrollSpeed);
  
    }
  
  };
  &lt;/script&gt;
  </code></pre>
  <p>I'm getting this error message:</p>
  <p>Error at line 2, character 12: This language feature is only supported for ECMASCRIPT_2015 mode or better: arrow function.JavaScript compiler errorUser.com - Exit Intent Mobile</p>
  <p>Error at line 5, character 15: This language feature is only supported for ECMASCRIPT_2015 mode or better: arrow function.JavaScript compiler errorUser.com - Exit Intent Mobile</p>
  <p>Error at line 7, character 14: This language feature is only supported for ECMASCRIPT_2015 mode or better: arrow function.</p>
  <p>Any ideas on how to implement that?</p>