Expand my Community achievements bar.

Revert DOM modification caused by target VEC on consent opt out

Avatar

Level 1

Is there a way to revert the DOM changes(e.g. background color) made using target VEC without reloading the page. we have a SPA website where target should only work when oneTrust cookie is accepted. The website currently don't reload when user accept/rejects the cookie, thus DOM changes made by target will persist until you move from one view to another or reload the page, and if the DOM modifications are in global components(header/footer), then moving from one view to another also not help. Implementing reload on cookie rejection has dependency with other tools, and the reason being seeking advice from community. we can definitely add a check in target custom code to check cookie consent before applying but then also take care when consent is rejected which add another layer of complexity. I am in favor of reloading the page but happy to explore if any one has better approach. Thanks 

Topics

Topics help categorize Community content and increase your ability to discover relevant content.

2 Replies

Avatar

Community Advisor

Hi @alexthomos22 

 

You can replicate the mboxDisable ( https://experienceleague.adobe.com/en/docs/target/using/activities/troubleshoot-activities/content-t... ) parameter into a cookie. 

 

From the browser console you can run: document.cookie = "mboxDisable=1; path=/";

 

You could trigger the same from your TagManager when consent is withdraw. 

With the cookie set it should require a refresh for any activities to stop being served. 


Now, I haven’t tested this, but in theory I believe it should work.

After setting the cookie your TagManager triggers the getoffer applyoffer (https://experienceleague.adobe.com/en/docs/target-dev/developer/client-side/at-js-implementation/fun... )

Hopefully - now with the mboxDisable cookie - Target should not return anything and remove any content delivered by activities. 

As a test you should be able to run the full script (setting the cookie and the getoffer/applyOffer) in the console to see that it actually works before trying to implement it. 

 

Let me know how it goes. 

Avatar

Level 1

Thanks for your suggestion @kandersen 
We already have this in place. All the launch rules including getOffer, triggerView executes only when consent is accepted. 

The challenge is we are not allowed to refresh the page cookie is rejected
Example of modification done by target 

setInterval(function(){console.log('hello')},1000);

Is there any out of the box way to stop above code executing when cookie is rejected and page didn't refresh?
Obviously, adding a check in code if(cookiePresent){console.log('hello')}
But this will work for simple use cases but when we have complicated use cases and the check itself fails then it could end up in GDPR violation