Closed sumiahTR closed 4 years ago
Please provide the necessary information.
Hii,
Sorry for the delayed response.
I have a google tag script.I added the klaro script to it.But it doesnt shows even when I accept the consant modal.
The google tags are loaded twice.
My first script is as:
script async='async' type="opt-in" data-type="application/javascript" data-name="googletag" data-src='https://www.googletagservices.com/tag/js/gpt.js'>
And the second script is as: When i try to run these it shows 'googletag.pubads is not a function' in the console. Please help.What does your Klaro config look like? Do you define an entry for the googletag
script?
yeah I do.My config.js file looks like { name: 'googletag', default: true, title: 'Google Tag', purposes: ['advertising'], cookies: [ [/^pk.$/, '/', 'www.googletagservices.com'], //for the production version [/^pk.$/, '/', 'localhost'], //for the local version ], callback: function(consent, app) { // This is an example callback function. console.log(consent); console.log( 'User consent for app ' + app.name + ': consent=' + consent ); if(consent === true) { / var obj = $(this); console.log(obj); / } }, required: false, optOut: false, onlyOnce: false, },
The async
option for your first script is the problem, I think. It causes that script to be loaded asynchronously in the background, while the two other scripts will be executed immediately, which is why pubads
is not available to them. You should either remove async
from the first script or use defer
for all scripts, which will also defer the loading and maintain the execution order between the scripts, which async
does not do.
Thanks for the reply. The 'definePassback' of googletag was the problem.That doesnt work sometimes or misbehaviours. so i rewrote it to another script. Thanks.:)
Steps to reproduce
Current behavior
Expected behavior