How to Incur Minimum Load on Server While Using Leaderboards for Non-profit Fundraising Software Solutions

There are several charity donation campaigns and non-profit fundraising campaigns that harness the power of leaderboards. And why not? Using leaderboards is, after all, a proven method of giving a boost to your fundraising campaigns. When non-profit fundraising software users use leaderboards in their campaigns, it not only helps them raise more funds but also increases the healthy competitive spirit among the donors.

With leaderboards, people feel motivated to donate more funds when their name gets displayed. Apart from this, when logos of organizations are displayed on the leaderboards, it helps in attracting sponsors for events which is another major advantage.

Sounds great, doesn’t it?

But as great as it sounds, all the server load can easily affect the performance of your campaign page. And hence, to combat the challenge of incurring minimum load to the server hosting the campaign page while displaying live donations, Ashish Mokashi from GammaStack working as a Ruby on Rails developer came up with an easy solution. 

Since Ashish is a Ruby on Rails developer, all the code pieces provided below are in Rails format.

There are mainly 3 ways to handle this problem: 

1. Create an on-demand refreshed leaderboard.
2. Update the displayed info based on various triggers and/or periodic requests.
3. Last but not the least, Actioncable. Using this powerful Pub/Sub mechanism introduced first in Rails 5 is one of the best approaches to solve this problem.

What is Actioncable?

Without going into heavy terminologies and creating confusion, Actioncable can be described as a Pub/Sub mechanism wherein the server adds the message created through backend to a channel, and the subscriber who has subscribed to the channel fetches it and acts accordingly. Websockets play a crucial role in this process .

How do we implement this solution?

First, let’s understand why a leaderboard is important. Various NPOs (non-profit organizations) conduct fundraising campaigns for specific causes, mainly to give back to the society. Now, in a single day campaign, there might be multiple donors not all based on the same geographical location as the NPO. Hence, it’s not practically feasible for the NPOs to acknowledge their donations and honor the donors in real-time during the campaign. Here, our leaderboard comes into the picture. The donors can see their names appear on the campaign landing page to confirm that their donation has been accepted. Also, this creates an environment of healthy competition among donors.

That being said, let’s dive into the technical implementation of Actioncable in the Rails application:

First, we need to set up the connection for Websocket accepted by the server:

Next, we will create a channel, DonationsChannel, to which the client subscribes to:

Now, the client-side script that has the instructions to display the changes on the front end based on the data received:


And, on the server-side, a simple event to broadcast the donation info to the DonationsChannel:

And here’s how your sample result should look like:

And thus, your real-time leaderboard is ready. Fairly easy to implement, right? So now you can easily integrate action cable into your own application. Find official Actioncable documentation here.

The above solution provided by Ashish Mokashi has immensely helped non-profit software and charity donation software owners working with GammaStack in improving the performance of their charity campaign pages. The leaderboards no longer take a toll on the campaign’s page performance and leaderboards get updated with names in real time seamlessly. 

Looking for a non-profit fundraising software solution or a charity donation platform? We at GammaStack provide a range of solutions that help non-profits maximize their campaign’s reach, create strategies, maximize ROI, increase donor retention, grow their donor lists and improve conversions. 

Apart from non-profit fundraising software, we also provide donor and volunteer management software, team fundraising software, community engagement software, crowdfunding platform software and many more for all your fundraising needs.

Are you a non-profit looking for a comprehensive non-profit software solution? Contact GammaStack today!

About the author:
Ashish Mokashi,
Ruby on Rails developer at GammaStack



Leave a Comment

Required fields are marked *