Send information about clicked link to the server before redirect

前端 未结 5 856
感动是毒
感动是毒 2020-12-21 05:20

We\'re creating a click tracking app, that builds heatmaps. I\'m writing a script which users are suppose to insert into their pages for tracking to work.

It works

5条回答
  •  -上瘾入骨i
    2020-12-21 05:44

    I would take a look at the navigator sendBeacon API mentioned in this stack overflow answer or directly linked to here.

    From the description on the site

    navigator.sendBeacon(url, data) - This method addresses the needs of analytics and diagnostics code that typically attempts to send data to a web server prior to the unloading of the document.

提交回复
热议问题