Skip to content

Latest commit

 

History

History
34 lines (24 loc) · 1.4 KB

README.md

File metadata and controls

34 lines (24 loc) · 1.4 KB


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