iFrames can be rewritten in a manner similar to the JavaScript method.
To Implement iFrame Rewriting
Given the typical iFrame:
<iframe src="https://www.youtube.com/yourvideo"></iframe>
-
Change src
attribute to data-src
.
-
Add class="optanon-category-[Category ID]"
with [CategoryID] replaced with the appropriate cookie category ID for the iFrame.
The end result will be:
<iframe data-src="https://www.youtube.com/yourvideo" class="optanon-category-[Cookie ID]"></iframe>
The OneTrust script will now rewrite this iFrame to the correct src
attribute and will only load the iFrame after consent is given.
To find your Cookie Category IDs, see Finding the Cookie Group IDs.
To Implement iFrame Rewriting when using Vendor Identification
Note
Vendor Identification, Categorization, and Consent is currently under Public Preview. Please contact your account representative or OneTrust Support to request access.
When endor Identification, Categorization, and Consent is enabled, tag rewriting logic considers the Service ID instead of category ID.
Given the typical iFrame:
<iframe src="https://www.youtube.com/yourvideo"></iframe>
-
Change the src
attribute to data-src
.
-
Add class="ot-vscat-[Service ID]"
, replacing [ServiceID] with the appropriate cookie category ID for the iFrame.
The end result displays as follows:
<iframe data-src="https://www.youtube.com/yourvideo" class="ot-vscat-[Service ID]" "></iframe>
The OneTrust script will now rewrite this iFrame to the correct src
attribute and will only load the iFrame after consent is given to this specific service.