Widget
Set up widget analytics
3 min
throughline analytics in the widget are recorded using matomo tag manager (mtm) however, you can work with your development team to capture events being generated by the widget in the containing page and send them to your measurement solution what events are available? throughline utilizes the window\ postmessage https //developer mozilla org/en us/docs/web/api/window/postmessage method to share event data with the parent page below is an example of the event window\ parent postmessage( json stringify({ event 'widget click to call' }), ' ' ); the following event types are available widget click to call widget click to emergency services widget click to helpline website widget click to online chat widget click to reporting form widget click to sms widget click to tty widget click to whatsapp how might you capture the analytics events? add this javascript snippet to capture analytics events and push them to your measure solution window\ addeventlistener( "message", (event) => { if (event origin !== "https //acme findahelpline com") return; if (event data event === 'widget click to call') { // add your code⦠} }, false );