🔥 User Streaks (Gamification)

Hi Gliders!

Just thought I’d share a quick video showing one of many ways you can introduce “user streaks” into your app. For example, you could use this in a Workout app where you reward members for logging workouts on a daily basis.

I’m sure there are better/more resource efficient ways of getting this done (I’ve already spotted ways to improve my own solution :man_facepalming:) but a Loqode student asked how it could be done in our Q&A this morning so I thought I’d post the solution I came up with here as well.

If you have any questions, want the Google Script code, or have suggestions on how this can be improved I’d love to hear from you!

Enjoy :popcorn:


Creative, nicely done :+1:

I think the only thing I would do differently would be to use JavaScript to calculate the streak, rather than calling an external script. I’d also pass the dates as integers - just makes them easier to work with as you can do direct numerical comparisons. Another option would be to transpose the list of dates into a Helper Table, and then figure it out from there. But that’s probably a bit of overkill, and you’d need enough rows in the table to cover the maximum streak length. So not really a good option.

Side note: I suspect the reason why you couldn’t use greater than/less than with the streak count is probably because your script returns the number as a string. If you run that through a Math column (multiply by 1) that should coerce it into a number.


Thanks Darren!

During the live Q&A itself I attempted to use the Javascript column but didn’t spend enough time tweaking to get it up & running… Then for some reason after the session I decided to try using a script and it worked so I kinda just rolled with it :sweat_smile:

But I agree, using the Javascript column would be a neater solution. Besides the fact that you won’t have to rely on external scripts, what are the benefits of doing it “in house”? I’ve always assumed it’s better but only from a “less breakable parts” and faster response time point of view… Which now that I think about it is probably more than enough reason… But interested to hear your thoughts :face_with_monocle:

And the direct numerical comparisons is also a great suggestion that I think you’ve mentioned to me before… One day it will sink in :rofl:

1 Like

Yeah, I think it’s generally better to keep everything self contained if you can. I used to use a lot of Apps Script when I first started with Glide, but these days I try to avoid it and will only use when absolutely necessary. In fact, my preference these days is to build exclusively with native tables. Not always possible, of course, but that’s what I do if I have the choice.

Just another note about passing dates as integers. Another reason to do that - probably the most compelling reason - is that it eliminates the possibility of being tripped up by variations in date formatting across user devices. That one is a real gotcha that can be really hard to debug.


Agreed. You present a tidy solution within Glide itself, but I prefer to avoid scripts if I can. As @Darren_Murphy mentions, keeping things self contained produces more responsive UX.

Nicely done :fire:

1 Like

What’s the Google Script link?

In case you wanted to see a rather complex solution that doesn’t involve Google scripts, this might work for you:

Warning: @Loqode’s solution is MUCH more elegant, but this variation is all contained within Glide tables.


I prefer @Loqode’s solution