Google Maps and other external iframes
Block maps and other external content until consent is obtained
Google Maps and many other external services are embedded using iframes. Alamarte Cookie Consent Pro allows you to keep this content from loading until the visitor has authorised the corresponding consent category.
Remove the external address from the src attribute, place it in data-acc-src and specify the category using data-acc-category. This prevents the browser from trying to load the external service too early.
Example of a normal iframe
An external iframe normally uses the src attribute to specify the address to load:
<iframe
src="https://example.com/content"
width="600"
height="450"
title="External content"
loading="lazy">
</iframe>
In this form, the browser may request the external content immediately when the page loads.
Iframe prepared for Alamarte Cookie Consent Pro
To keep the iframe blocked, use data-acc-src instead of src and assign the appropriate category:
<iframe
data-acc-category="marketing"
data-acc-src="https://example.com/content"
width="600"
height="450"
title="External content"
loading="lazy">
</iframe>
The value used in data-acc-category should correspond to the category you have defined for that service.
1. Obtain the original code
Copy the embed code provided by the service you want to use.
Keep the attributes required for its operation, such as dimensions, title, permissions or loading options.
2. Change src to data-acc-src
Locate the external address in the iframe and change only the name of the attribute that contains it.
The address should remain stored in data-acc-src while consent has not been granted.
3. Add the category
Add data-acc-category to the iframe and specify the consent category that corresponds to the service.
The classification should be based on the actual purpose of the content you are embedding.
4. Check the saved code
After saving the article, module or content where you inserted the iframe, review the code again.
Confirm that the data-acc-category and data-acc-src attributes are still present and that the editor has not automatically restored src.
Google Maps example
When Google Maps provides embed code, the map address normally appears inside src. To prepare it for Alamarte Cookie Consent Pro, keep the complete address but move it to data-acc-src.
Simplified example:
<iframe
data-acc-category="marketing"
data-acc-src="FULL_MAP_URL"
width="600"
height="450"
style="border:0;"
allowfullscreen=""
loading="lazy"
referrerpolicy="no-referrer-when-downgrade"
title="Google Maps">
</iframe>
Replace FULL_MAP_URL with the address provided by Google Maps and use the category you have defined for this service.
Other external services
The same procedure can be used with other services that are integrated using an iframe and whose loading should depend on consent.
The service does not need to be Google Maps or YouTube; what matters is that the external address remains pending in data-acc-src.
Content editors
Some editors may modify or clean HTML code when saving.
If you use JCE or another editor, confirm that it allows the custom data-* attributes required by Alamarte Cookie Consent Pro to be preserved.
Test without consent
Open the page in a private or incognito window and initially do not authorise the category associated with the iframe.
Check that the external service does not load before consent is given.
Test after accepting
Authorise the corresponding category and check that the content can be activated correctly.
This test confirms both the initial blocking and the subsequent activation of the resource.
Do not use src and data-acc-src at the same time: if the actual address remains in src, the browser may load the service before consent is obtained. For a blocked iframe, the external address should remain only in data-acc-src until Alamarte Cookie Consent Pro can activate it.

ES
EN



