Give a unique ID to find where a form was clicked on from

Hello! I am trying to figure out how to apply a unique ID when entering a form so you can see where it was clicked from. I have a store where each row in Airtable posts a new object for sale. I want the ‘purchase item’ button to lead to a form where they can fill in all their information but I can’t figure out how to assign some sort of unique ID so that I can correlate the item they want to buy to the information they put into the form.

Is anything like this achievable or is there any advice? Thanks so much for anything and everything!

Okay, so let’s review the requirements:

  1. There’s a web page (somewhere) that has an item for sale on it and a purchase button.
  2. When the purchase button is clicked, you want a web form (presumably an Airtable form) to prompt the buyer for their details.
  3. In the process of providing the buyer’s details, you want the Airtable form to also capture the item’s unique ID (like a SKU) and perhaps analytics such as the web site where the purchase button was clicked.

Is that what you’re asking?

Observations…

  • The web page displaying the item for sale should include at the very least, a hidden field containing the SKU.
  • The purchase button should be smart enough to read the hidden field where the SKU is stored on the web page.
  • Conveying the SKU value when linking to the Airtable form is achieved through a form field that is pre-populated via the form’s URL (this is a standard feature in all forms tools including Airtable).

I don’t typically build e-commerce systems with Airtable, but I’m pretty sure these are the mechanics required to capture purchase data including unique product codes and such.

Hey Bill! Thanks so much for taking the time to help me out. What you’re saying with the hidden SKU sounds like a good idea but let me layout my situation to see if I could still apply it.

  • I have a webpage built around AirTable that loads each record in my base but all on the same home page. So when I update the base with a new record, it updates the page. There is only one page, each product doesn’t load into a unique page

  • I have a button to press to purchase the item on each line. The button is linked to a link field in the record. So I can put unique web address for each record in the base, so whenever they press that purchase button, it has the ability to go to any webpage for each record.

So I guess what I’m trying to do it make it so I can have an Airtable form that populates a unique web-address into the link field of each new record, so that I can see which item on the page they are specifically buying.

Do you think your suggestion above would still be a good solution that I should dig deeper into? I’m also open to any other solutions within Airtable that I might be overlooking or using Zapier to move data around. Thanks again for helping out!

More clearly, I think you mean the button is instrumented in a way that it executes the URL in the link field, yes?

Exactly right! It is just for executing the URL in the link field.

And where [exactly] do these links send the buyers?

So in theory I want them to go to my Airtable form so I can collect the information and have it update my base that this item is no longer available.

Okay - so… the URLs that the buttons will execute are all the same except for one important difference - they each need to be instrumented to include a parameter that indicates the item number or ID of the product they represent. This is known as pre-fill parameters.

1 Like

Oh my goodness Bill! You are the best! That’s exactly what I’m looking for!!! Thank you so much for helping me work through that! I owe yah a beer!

Not really. I’m almost certain Airtable is 95% to blame for making me look smart.

One more fast question for you! I’ve read up about prefill_ and learned a ton, but i’m having trouble locating documentation on variable syntax. I have https://airtable.com/1234?prefill_ but i can’t figure out how to fill the form field with information from another field. For instance, reading up I found the date prefill_ is ?prefill_Date=TODAY() or ?prefill_Date=Now() but what is the syntax for pulling from a records field?

Is there a page that tells me the syntax for all these options that I can’t find because i’m probably using the wrong words?

Thanks again for all the help Bill and for nudging me in the right directions!

I figured it out! Using this formula:

CONCATENATE("airtable.com/form?prefill_xxx=",{ID Number})

That prefills my form and then I hid the field and now I have a hidden tracking system!

1 Like

Is that really working for you? I would have guessed it would be …

...form?prefill_xxx=",{ID Number}

Great to see it coming together for you.

Now you have the underpinning infrastructure for many tracking analytics. Using javascript you can, for example, capture when a user hovers over a product image and record that subtly in the background and pass the hover data into the Airtable form as yet another prefill value.

You are correct as always Bill! I forgot to type the rest out here. I’ll edit it above incase future people use this thread for their own problem.

Doing some more research though it looks like I can’t have the prefill information return a value in my table when it’s a hidden field in my form which really takes the wind out of the sails. Do you know of a work around to make a form field read only so that I can still use this method without anybody able to change the value of my ID number?

That (I believe) is currently the state of Airtable as evidenced by this lengthy and heated discussion. I don’t believe this feature request has been addressed (yet) but it definitely warrants their attention. @Justin_Barrett can probably advise us both.

There are some options though such as Air2Table and other forms handlers that would then send the data into Airtable via Integromat or Zapier.

1 Like

I appreciate the thought, but I’m afraid that I don’t have any special insight into this issue, or any other issues for that matter.

That aside, I’ve got a question for @Alec_Kap: why does the field that you’re pre-filling need to be hidden? If someone is purchasing a given item, there’s no need to hide the info about their purchase. In fact, I think it would make the transaction more clear to leave it in view.

I haven’t seen much in this discussion that describes the details of your base, but here’s a rough setup that (to me) would work fairly easily.

Two tables: [Items] and [Purchases]. The [Items] table is where you have everything that you’re selling. The form a buyer uses to purchase a given item would be in the [Purchases] table, and would contain an {Item} link field that would allow a single selection from [Items]. A formula field in the [Items] table would build a custom link to the [Purchases] form, pre-filling the {Item} link field to point to the related item.

I think he’s concerned that a product “key” field if exposed could be changed intentionally or by accident, rendering the purchase event ambiguous.

True, but that could be largely overcome by setting the link field as a required item. The worst the purchaser could do is delete the link, but because it’s a required field, they’d have to choose it again to submit the form and complete their purchase, and chances are they’d choose the same item and not a different one. If the field were something like text or a number, that would be more problematic, but a link is harder to mess up.

Bill is completely correct! I’m looking to make sure nobody accidentally alters the record. I already have prefill filling in other information to make sure people have transparency in what they are specifically buying.

Your solution is interesting but seems a little messy/cumbersome visually. Since Airtable can’t really do this natively I’m exploring Bills thoughts on using a different service and pairing them with Zapier :man_shrugging:

I’m open to other ideas if you have them though! Thanks for all the help!

When using a form, linked records can’t be altered. All you see is the name from the linked record’s primary field. In Airtable itself, you can potentially see all the other details of the linked record, but forms only show you the primary field contents.

Can you elaborate on what makes this option messy/cumbersome? In the test I ran, it didn’t feel that way, but again, I don’t know the specifics of your base design. Here’s how it looked in my own quick test:

19%20PM

As I said above, the worst thing the user can do is click the “x” at the end of the selected item to delete it. Because it’s a required field, though, they’d have to just pick it again to complete the order.