---
title: "Discussion on \"How to log user activities using the Beacon Web API?\" | Hashnode"
description: "Discussion on \"How to log user activities using the Beacon Web API?\". The Beacon API is a relatively unknown, lightweight, and efficient way to log web page activities to a server. It is a JavaScript API that helps the developer to send a small amount of data such as, analytics or tracking information, debugging, or di..."
url: "https://hashnode.com/posts/how-to-log-user-activities-using-the-beacon-web-api/5f9672d1fbdce372c9a5827f"
---

[Feed](https://hashnode.com/feed) /

Discussion

# [How to log user activities using the Beacon Web API?](https://blog.greenroots.info/how-to-log-user-activities-using-the-beacon-web-api?utm_source=hashnode&utm_medium=feed)

The Beacon API is a relatively unknown, lightweight, and efficient way to log web page activities to a server. It is a JavaScript API that helps the developer to send a small amount of data such as, analytics or tracking information, debugging, or di...

Oct 26, 2020 · 7 min read · blog.greenroots.info  
Updated Oct 28, 2020  
Read the article

-   [#javascript](https://hashnode.com/tag/javascript)
-   [#programming](https://hashnode.com/tag/programming)
-   [#web-development](https://hashnode.com/tag/web-development)
-   [#beginner](https://hashnode.com/tag/beginner)
-   [#productivity](https://hashnode.com/tag/productivity)

## Written by

[Tapas Adhikary](https://hashnode.com/@atapas)

@atapas · Bangalore

  
[View profile](https://hashnode.com/@atapas)

Educator @tapaScript | Founder CreoWis & ReactPlay - Writer - YouTuber - Open Source

Co-Founder, @CreoWis | Teacher, @tapaScript | Founder, @ReactPlay | YouTuber | Writer | Human

## Responses 7

Markdown supported · ⌘↵ to post

[Bolaji Ayodeji](https://hashnode.com/@bolajiayodeji)

[Oct 26, 2020](https://hashnode.com/posts/how-to-log-user-activities-using-the-beacon-web-api/5f9672d1fbdce372c9a5827f/comment/5f96f129ce17e910d70cdeae)

Love this [Tapas Adhikary](https://hashnode.com/@atapas), would try this out!

[Oct 26, 2020](https://hashnode.com/posts/how-to-log-user-activities-using-the-beacon-web-api/5f9672d1fbdce372c9a5827f/comment/5f96f129ce17e910d70cdeae#reply-5f96f341ce17e910d70cdeed)

Sure thing. Thanks Bolaji.

[Edidiong Asikpo (Didi)](https://hashnode.com/@didicodes)

[Oct 26, 2020](https://hashnode.com/posts/how-to-log-user-activities-using-the-beacon-web-api/5f9672d1fbdce372c9a5827f/comment/5f96c281cf87190b5fdd25c2)

Very insightful article. I love it [Tapas Adhikary](https://hashnode.com/@atapas).

[Tapas Adhikary](https://hashnode.com/@atapas)

[Oct 26, 2020](https://hashnode.com/posts/how-to-log-user-activities-using-the-beacon-web-api/5f9672d1fbdce372c9a5827f/comment/5f96c281cf87190b5fdd25c2#reply-5f96c872f9885b0b8018084d)

Thank you [Edidiong Asikpo](https://hashnode.com/@didicodes), I'm glad.

[Sébastien Portebois](https://hashnode.com/@sportebois)

[Oct 26, 2020](https://hashnode.com/posts/how-to-log-user-activities-using-the-beacon-web-api/5f9672d1fbdce372c9a5827f/comment/5f96aa95f9885b0b801805d3)

I forgot about this, thanks for sharing 🙏

It’s also worth noting that Beacon API isn’þ restricted by CORS policies as much as regular XHRs requests.

The specs: [w3.org/TR/beacon](https://www.w3.org/TR/beacon/)

And some interesting story about CORS, Beacon, Chrome (and Firefox) : [medium.com/@longtermsec/chrome-just-hardened-the-…](https://medium.com/@longtermsec/chrome-just-hardened-the-navigator-beacon-api-against-cross-site-request-forgery-csrf-690239ccccf)

[Tapas Adhikary](https://hashnode.com/@atapas)

[Oct 26, 2020](https://hashnode.com/posts/how-to-log-user-activities-using-the-beacon-web-api/5f9672d1fbdce372c9a5827f/comment/5f96aa95f9885b0b801805d3#reply-5f96ab4ef9885b0b801805db)

[Sébastien Portebois](https://hashnode.com/@sportebois), Thanks!

Great point about CORS and thanks for the links. Must go through.

[Shamaayil Ahmed](https://hashnode.com/@shamaayil)

[Oct 26, 2020](https://hashnode.com/posts/how-to-log-user-activities-using-the-beacon-web-api/5f9672d1fbdce372c9a5827f/comment/5f9690cd40346172a86c2f8c)

Really informative post.

[Tapas Adhikary](https://hashnode.com/@atapas)

[Oct 26, 2020](https://hashnode.com/posts/how-to-log-user-activities-using-the-beacon-web-api/5f9672d1fbdce372c9a5827f/comment/5f9690cd40346172a86c2f8c#reply-5f969335fbdce372c9a58428)

Thank you very much!

[Vamsi Rao](https://hashnode.com/@vamsirao)

[Oct 26, 2020](https://hashnode.com/posts/how-to-log-user-activities-using-the-beacon-web-api/5f9672d1fbdce372c9a5827f/comment/5f96876e40346172a86c2f01)

Great article, will try this soon!

[Tapas Adhikary](https://hashnode.com/@atapas)

[Oct 26, 2020](https://hashnode.com/posts/how-to-log-user-activities-using-the-beacon-web-api/5f9672d1fbdce372c9a5827f/comment/5f96876e40346172a86c2f01#reply-5f968a69fbdce372c9a583e3)

Great! Thanks.

[Bhanu Teja Pachipulusu](https://hashnode.com/@pbteja1998)

[Oct 26, 2020](https://hashnode.com/posts/how-to-log-user-activities-using-the-beacon-web-api/5f9672d1fbdce372c9a5827f/comment/5f967a1dfbdce372c9a58326)

Exactly what I needed this week. Thanks 🙏 Bookmarked.

[Tapas Adhikary](https://hashnode.com/@atapas)

[Oct 26, 2020](https://hashnode.com/posts/how-to-log-user-activities-using-the-beacon-web-api/5f9672d1fbdce372c9a5827f/comment/5f967a1dfbdce372c9a58326#reply-5f96819e40346172a86c2eae)

That's awesome!

[Chris Bongers](https://hashnode.com/@dailydevtips)

[Oct 26, 2020](https://hashnode.com/posts/how-to-log-user-activities-using-the-beacon-web-api/5f9672d1fbdce372c9a5827f/comment/5f9678dbfbdce372c9a58303)

Nice I remember Beacons being quite big from the apple days, not sure if this API can also be used for those?

[Tapas Adhikary](https://hashnode.com/@atapas)

[Oct 26, 2020](https://hashnode.com/posts/how-to-log-user-activities-using-the-beacon-web-api/5f9672d1fbdce372c9a5827f/comment/5f9678dbfbdce372c9a58303#reply-5f96796040346172a86c2e49)

Good point [Chris Bongers](https://hashnode.com/@dailydevtips), certainly something to check out. Thanks for reading and commenting!
