A click and action stream tracker.
There are two parts to get this running: deploying the server and adding the client scripts.
You'll want to commit your changes.
- Create a bot in Telegram by following these (instructions)[https://core.telegram.org/bots#6-botfather].
- Save the bot API key and add the following line to
packages/server/Dockerfile
:
ENV telegram__bot_api_key <bot api key>
- Add this bot to the channel you'd like analytics messages to appear in.
- Reveal the channel/chat ID by following these (instructions)[https://stackoverflow.com/questions/33858927/how-to-obtain-the-chat-id-of-a-private-telegram-channel].
- Add the chat ID to the Dockerfile under
packages/server/Dockerfile
:
ENV telegram__channel_id <chat id>
- Build and deploy the server via docker to your favorite server:
cd packages/server;
docker build --name clarity/server@latest .
docker run -d --name server clarity/server@latest
- Build the Javascript client:
cd packages/client-web;
npm run build;
- Copy the compiled Javascript to your static folder:
cd packages/client-web;
cp dist/js/index.js <path to static folder>
- Include via script tag.
<script src="<prefix>/index.js" type="application/javascript" async></script>
- Initialize the client:
init(<endpoint base url>)
- Add the
aria-label
attribute to any button you want to track :).