Advertisement
NonplayerCharacter

GTM | Conditional display features

May 17th, 2018
339
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // Simo:
  2. // Easiest way to do it is to store a reference to the original task in the same place where you null it. So the customTask becomes:
  3.  
  4. function() {
  5.   var cookieConsent = {{cookieConsent}};
  6.   return function(model) {
  7.     if (cookieConsent === 'opt-out') {
  8.       window._originalDisplayFeaturesTask = model.get('displayFeaturesTask');
  9.       model.set('displayFeaturesTask', null);
  10.     }
  11.   };
  12. }
  13.  
  14. // and then if you want to "reset" the task, you can set
  15.  
  16. model.set('displayFeaturesTask', window._originalDisplayFeaturesTask)
  17.  
  18. // in customTask.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement