en рус

Javascript Events

All available events:

  • tocha:open-chat-window when the user opens the chat window
  • tocha:first-message-send when the user writes the first message in the chat
  • tocha:message-send when the user writes a chat message
  • tocha:send-contacts contact form submit event
  • tocha:send-contacts-email email send event in contacts form
  • tocha:send-contacts-name name send event in contact form
  • tocha:send-contacts-phone send phone event in contacts form
  • tocha:send-contacts-telegram send telegram event in contacts form

If you monitor the conversion of your site, events can be used to track goals in Yandex.Metrica or Google Analytics.

JavaScript events

Yandex. Metrics:

document.addEventListener('tocha:loaded', () => { let te = document.getElementsByTagName('telegram-web-chat')[0]; te.addEventListener('tocha:first-message-send', (e) => { ym(1234567,'reachGoal','first-message-send'); }); te.addEventListener( 'tocha:message-send', (e) => { ym(1234567,'reachGoal','message-send'); }); te.addEventListener('tocha:open-c hat-window', (e) => { ym(1234567,'reachGoal','open-chat'); });});

More about setting goals in Yandex.Metrica< /p>