DEV Community

Cover image for Fixing My Gratuity Calculator: Adding Social Media Sharing Inside the Tool
Ahsan Aman
Ahsan Aman

Posted on

Fixing My Gratuity Calculator: Adding Social Media Sharing Inside the Tool

In today’s post, I want to share my experience building a Gratuity Calculator. The goal of the project was simple: help employees easily calculate gratuity based on salary and years of service.

While the calculator itself worked fine, I realized one major feature was missing:
Social Media Sharing Buttons so that users can share their calculated result with friends, colleagues, or HR teams.
What is Gratuity? (Context for readers)


Gratuity is a retirement benefit given to employees who complete a minimum period of service (for example, 5 years in India). It is calculated using a simple formula:

Gratuity = (Last Drawn Salary × 15 × Number of Completed Years) / 26

A gratuity calculator saves time and ensures employees can quickly know what they are entitled to.

  1. Problem I Faced

When I built my calculator, it could calculate values correctly. But there was no easy way for users to:

Share the result on Twitter, Facebook, LinkedIn, WhatsApp

Spread awareness about gratuity benefits

This meant less engagement and fewer people discovering the tool.

  1. Solution: Adding Social Media Share Buttons

I explored different ways to add social share buttons:

Option 1: Use HTML + JavaScript (Manual Links)

<!-- Twitter Share -->
<a href="https://twitter.com/intent/tweet?text=Check+your+gratuity+using+this+calculator!&url=https://yourwebsite.com" target="_blank">
Share on Twitter
</a>

<!-- Facebook Share -->
<a href="https://www.facebook.com/sharer/sharer.php?u=https://yourwebsite.com" target="_blank">

Share on Facebook


Share on LinkedIn

Option 2: Use a Free Library (e.g., ShareThis or AddThis)

Go to ShareThis

Generate free social media share buttons

Copy the code and paste it inside your calculator’s HTML

Example:

  1. Implementation in My Calculator

I added the sharing section just below the calculation result. This way, once users calculate gratuity, they immediately see the option to share it.

Your gratuity is: ₹50,000

  1. Final Thoughts

Adding social media icons inside my gratuity calculator:

Improved engagement

Allowed users to spread the tool organically

Helped my project gain visibility on social platforms

If you’re building any tool (finance, HR, productivity), I strongly recommend adding share buttons for better reach.

👉 You can try my Gratuity Calculator here:[](https://gratuitycalculatorae.com/)

Top comments (0)