Forum Academy Marketplace Showcase Pricing Features

Deals app - want to record how many times a deal is "used"

I have an app that displays food and drink promotions. An example would be 10% off meal at xxxx restaurant. Once the deal is clicked on it brings up a page with a ‘validate’ button. When this is clicked I want it to record against the deal (data thing) that it has been used. Essentially I want to be able to go back and see how many times a deal is used in a given month.

Does anyone have any ideas?

I’m not sure if I get you. But if all you want to do is to know how many times a deal has been used, i.e. the validate button has been clicked for a particular deal, you can do the following.
Add a number field to the deal thing, say timesUsed, which is initially set to zero. Anytime a deal is selected and the Validate button clicked, increment the timesUsed field of the deal by 1.
You can even used this field to limit the number of times a deal can be used in say a month.

1 Like

@kwakusandy is correct, that is the most straightforward way to do it.

If you’re needing more metrics and want to dig into analytics later, I recommend going the next step deeper and create a new database thing modeled after log entries. This helps with organization of events a TON in my apps. Let’s say you have a type of thing log_entry_deal_used with a few properties:

  • Creator: type User (person who clicked it)
  • Date Created
  • Deal: type Deal (what you want to link this log entry/deal click to)
  • …anything else you can imagine needing to track

With this approach, you can have several types of log entries, each recording their own unique data set, and you can later go back and filter a search for any type of event you choose to track via log entry. You could do a search on type thing “log_entry_deal_used” Deal = [deal] and filter: :date_created (you can choose a date range here or do a bit of math to grab a specific month).

2 Likes

Thanks @kwakusandy this was very helpful. Unfortunately I am pretty beginner at this so I just wanted to clarify in more detail. I have created a field for the thing ‘deal’ called ‘times used’. I have started a workflow ‘when button validate is clicked’ > ‘make changes to deal’ > thing to change ‘current page deal’ > change another field ‘times used = xxxxx’. Im not sure what to do here to make the field initially set to zero and then increment +1 everytime the button is clicked. Thanks for your help. Alex

Thanks for your idea @philip. I have plans to build more analytics into the site as I go, but just want to know for now how many times a deal is used so I know what value this is providing businesses (so I know what to charge). I have only just started using bubble 2 weeks ago. Would you have any suggestions in how to learn more complex bubble programming like you have described above? Might be simple for you but I have no programming experience at the moment. Yet amazed at how easy bubble has been to learn so far. Thanks for your help, Alex

Hi @dickson.alex10 this is @kwakusandy (just realized i have two different bubble accounts). Anyway i’m happy to assist you. Since you’re a bubble beginner and really wants to learn, i will try and assist you as much as i can.
I’m going provide you answers to you question on how to implement your deals idea.
But first off, to be able to develop any system, you need to know the WHAT and the HOW.
Using bubble as an example, you need to know WHAT you want to do and HOW to do it in bubble.
The WHAT concept is the same no matter the programming language you’re using. But the HOW will depend on the language.
If you had a programming background, you will already have knowledge about the WHAT and all you will need to know is HOW to this or that in bubble.
Using your particular situation as an example, the WHAT is knowing that, to be able to keep score on how many times a deal has been used, you will need to have a counter attached to the thing, which is initially set to 0 when the thing is been created. And anytime the thing is used, you retrieve the counter, increment it by one and store it again. This concept will be the same no matter the programming language (e.g. Java, php, bubble, etc) used.
But how to do this will be different from one programming language to another.
Luckily, even as a non-programmer, you can learn the WHAT concepts and the HOW, through looking at examples. So if you haven’t already done it, this is where you will have to spend some time at the bubble learning center (https://bubble.io/documentation).
Believe me spending about that 1hr to go through all the videos (you can skip the long video on responsive design for now) will save you days and weeks of frustration and waiting for answers from our great forum members.
As you watch the videos, ask youself, where in my application can i apply this idea. I don’t know exactly the application you’re building but just looking at the question you asked about creating discount deals for restaurants i can see you applying several of the concepts in the videos, with the exception of the APIs which i’m sure you will need at one point.
Then when you’re done you can look at the lessons so get a practice of the concepts you learn from the video.
I know there is the temptation to dig right into bubble and start developing your application, but believe me, just spending one day going through the bubble documentation will teach you several programming concepts (the WHAT) and HOW to do things in bubble. That was a long speech. Ok i will now give you a possible solution to your specific question.

So i’m guessing you’re going to have an admin page for adding the discount deals. As i mentioned earlier (using my handle @kwakusandy), you need to have number field say “times used” on the deal thing. When a new deal is created, this is where you initialize the “times used” for the deal to 0.
Then on the page where you display the deals, have a repeating group, and set the type of content to Deal.
Then for the Data source do a search for Deals as below:

For the activate button add a workflow the make changes to the current cell’s deal by incrment by 1 it’s tmes used field (that is get the original value, add 1 and store the new value). See below:

Something to note: For the discount, i’m guessing they will be a percentage value. You can store this as a decimal number (e.g 0.10 for 10%, or 0.15 for 15%). Then when you are displaying it, you format it as a percentage. Or you can simply store the percantage number like 10, and append the % sign when displaying.
Hope this helps.

Thank you so much @seanhoots. Your suggestion has worked perfectly! Sometimes I’m able to figure things out myself but other times even simple stuff I get stuck on. Great to have a forum with people like you to help out. Hope I can help down the track somehow. I will go through the documentation again for sure. Thanks again, Alex

@seanhoots Just wondering if you had any ideas here… The reason I want to record the amount of times used is so I can tell how much value its bringing a business. The problem is, if people want, they could just click ‘activate’ as many times as they please, which would skew the data. I want to make it so people can only “activate” a deal once per day. Do you think theres an easy way to do this? The workflow currently looks like this:


RIght now, a User does not have to be logged in to use the app. I wonder if theres a way to say… if User clicks 'activate then increase ‘deal times used’ by 1, for a maximum of 1 per day.

This topic was automatically closed after 70 days. New replies are no longer allowed.