-2

Say we have two buttons with the same url, is is possible for us to figure out which button was clicked by my user to fetch that particular page.

I have already explored query parameters (ref_ tag) so I am looking for a second approach. Anyone has inputs?

Shriyal
  • 1
  • 1
  • It's unclear what level you're talking about and what framework. If you're talking about JS code/event handlers inside the origin page, then *yes*, you can distinguish them. If you're talking from the perspective of the server hosting the target URL then there's no way to distinguish these two (unless, of course, they explicitly provide some distinguishing feature like different query parameters). – Joachim Sauer Jun 15 '23 at 11:21

1 Answers1

0

Differentiate using distinct URL paths: Instead of relying solely on query parameters, you can differentiate the buttons by assigning different URL paths to each button. For example:

Button 1 URL: https://example.com/page/button1 Button 2 URL: https://example.com/page/button2 When the user clicks a button, the associated URL path can help you identify which button was clicked. You can parse the URL path on the server-side to determine the source.