Local Storage property names
Normally, ThumbmarkJS will store its data in the local storage property thumbmark_visitor_id.
Cache will be stored in thumbmark_cache.
You can override these property names by setting the property_name_factory option.
The property_name_factory option is a function that takes a string and returns a string. The function is called with names visitor_id and cache.
A simple implementation for renaming your properties could look like this:
const t = new Thumbmark(
{
api_key: 'your-api-key',
property_name_factory: (name) => `${name}_your_suffix`,
}
);
If you want to fully customize the property names, you can do something like:
const t = new Thumbmark(
{
api_key: 'your-api-key',
property_name_factory: (name) => {
if (name === 'visitor_id') {
return 'your_visitor_id_property_name';
} else if (name === 'cache') {
return 'your_cache_property_name';
}
return `your_prefix_${name}`; // fallback for future-proofing
},
}
);