Limiting Code Claims per Customer with the HTML Button
Introduction
When you distribute codes using the HTML button, you can now pass a unique identifier for each customer so that the same person cannot claim more than they are entitled to. Previously, because the button had no way of recognising who was claiming, a customer could refresh the page and be issued additional codes. By passing a customer identifier, Uniqodo can recognise a returning customer and apply your per-customer code rules.
This is done through a new data-uid parameter in the button snippet, which works alongside the existing button parameters such as data-mode and data-url. If you are not yet familiar with the HTML button, see HTML Button: Issuing Unique Codes on Web Pages first.
Info: Passing a customer identifier is optional. If you do not need to limit claims per customer, you can continue using the HTML button exactly as before.
Adding the data-uid Parameter
The data-uid parameter holds the unique identifier of the customer viewing the page, for example their customer ID, membership number, or email address. It is added to the same button snippet that is emailed to you when the promotion is set up, alongside the existing parameters.
A standard button snippet looks like this:
<div class="uniqodo-btn" data-promoid="61d2ff5a0d947be8e3327f72b18677f0" data-mode="1" data-url=""> <script async="" src="https://track.uniqodo.com/button.js"></script> </div>
To limit claims per customer, add data-uid and set it to that customer's unique value:
<div class="uniqodo-btn" data-promoid="61d2ff5a0d947be8e3327f72b18677f0" data-mode="1" data-url="" data-uid="customer-98765"> <script async="" src="https://track.uniqodo.com/button.js"></script> </div>
Because the value is different for every customer, it is inserted dynamically by your development team, drawing the identifier from your own system when the page loads, rather than being typed in by hand.
- To pass an identifier, set
data-uidto the customer's unique value. - To pass no identifier, leave it empty:
data-uid="". The button will behave as it did previously, with no per-customer limit applied.
Important: Unencrypted user identifiers are limited to 128 bytes in length. For most identifiers, such as an email address or account number, this is comfortably within the limit, so it will only be a consideration if you pass an unusually long value. This is the same limit that applies to existing code-claim methods.
How Per-Customer Limits Are Applied
Once you pass a customer identifier, the limit starts working automatically. By default, promotions allow one code per customer unless you have set them up otherwise, so simply passing data-uid is enough to stop the same customer claiming more than once. There is no separate setting to switch on.
If you need different behaviour, this is governed by the customer-level rules on the Code Settings step of the promotion workflow, which is also where you would allow a customer to claim more than once.
Summary
The data-uid parameter lets the HTML button identify the customer claiming a code, so you can prevent the same customer from claiming multiple codes by refreshing the page. It is optional, and leaving it empty preserves the previous behaviour. Once a customer identifier is passed, the default of one code per customer applies automatically, with any different behaviour controlled from your promotion's Code Settings.