This PR adds support for a {usp.uspString} macro that is replaced with the US Privacy consent string, which is acquired using the IAB's USP API if it is available. The implementation follows the reference code from IAB-- the API is invoked directly if it is available in the same window as the player, or via postMessage() if in a parent window. This also follows the same basic pattern as our implementation of TCF in this plugin, with a key difference. TCF triggers an event whenever the consent string changes, which lets us easily keep the string updated. The USP API does not, and manual asynchronous API calls are necessary to update it.
Description
This PR adds support for a
{usp.uspString}
macro that is replaced with the US Privacy consent string, which is acquired using the IAB's USP API if it is available. The implementation follows the reference code from IAB-- the API is invoked directly if it is available in the same window as the player, or viapostMessage()
if in a parent window. This also follows the same basic pattern as our implementation of TCF in this plugin, with a key difference. TCF triggers an event whenever the consent string changes, which lets us easily keep the string updated. The USP API does not, and manual asynchronous API calls are necessary to update it.Test pages with reference USP API implementation:
Open the pages and select different options from the "Do Not Sell My Data" menu.