Skip to content

Using the browser's Beacon API to send data when the page unloads.

License

Notifications You must be signed in to change notification settings

RequestMetrics/Beacon_Example

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation


Beacon API Example

Using the browser's Beacon API to send data when the page unloads. This project is demonstrated in the video posted on the Request Metrics Blog, "Using the Beacon API".

Setup

In order to test the cross-origin constraints of the beacon, we need to host this project from multiple domains. Please add the following entries to your hosts file.

127.0.0.1 example.com
127.0.0.1 beacon.requestmetrics.com

You can run everything on localhost if you wish, but be sure to change the beacon URL in client.js.

Usage

To start the project, run npm start and open a web browser to http://example.com:3000/.

Reference

About

Using the browser's Beacon API to send data when the page unloads.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published