clarity-js
Version:
An analytics library that uses web page interactions to generate aggregated insights
2 lines (1 loc) • 854 B
JavaScript
!function(){"use strict";function i(i){var e=[window.clarity("time"),52];switch(i){case 0:case 1:case 2:case 3:case 4:case 5:case 6:e.push(i)}!function(i){"undefined"!=typeof window&&window.clarity&&window.clarity("queue",i)}(e)}function e(e){switch(e.visibility){case"maximized":i(3);break;case"minimized":i(4);break;case"hidden":i(2)}}function n(e){i("online"===e.availability?0:1)}function t(e){"agent"===e.author.type?i(5):i(6)}window.LiveChatWidget&&(window.LiveChatWidget.on("visibility_changed",e),window.LiveChatWidget.on("new_event",t),window.LiveChatWidget.on("availability_changed",n)),"undefined"!=typeof window&&window.clarity&&window.clarity("register",(function(){window.LiveChatWidget&&(window.LiveChatWidget.off("visibility_changed",e),window.LiveChatWidget.off("availability_changed",n),window.LiveChatWidget.off("new_event",t))}))}();