Hi Shane,
I'm using 'Custom CSS and JS PRO' to add HTML to the head of my pages. Here's the script that should be pushed in the <head> of my 'projecten' page (hidden link):
<!-- Begin Google Ad Manager -->
<script async src="hidden link"></script>
<script>
window.googletag = window.googletag || {cmd: []};
/**
* Locatie ophalen.
* De locatie wordt uit de Toolset parameter 'toolset_maps_distance_center' gehaald.
* Mogelijke waardes van deze parameter: postcode, provincie, long & lat (indien het script om die waarde te interpreteren niet werkt).
*/
var currentUrlString = window.location.href;
var currentUrl = new URL(currentUrlString);
var currentLocation = currentUrl.searchParams.get('toolset_maps_distance_center');
console.log('toolset_maps_distance_center: ' + currentLocation);
// Hier nog checken of de toolset_maps_distance_center (currentLocation) bestaat
//var zipcode = 0;
getPubCodeByLocation(currentLocation, bannering);
function bannering(pubCode) {
console.log('Dit is de geretourneerde pubCode: ' + pubCode);
googletag.cmd.push(function () {
/** SizeMapping opzetten */
// BANNER
var mapping_BANNER = googletag.sizeMapping().addSize([320,0],
[[300,75]]).addSize([980,0],
[[980,150],[960,150],[970,250],[840,150],[840,250],[728,90]]).build();
/** Slots definiëren */
// BANNER_ABOVE_1
googletag.defineSlot('/21768925892/5860_I000/I0181', [],
'gpt-ad-BANNER_ABOVE_1')
.defineSizeMapping(mapping_BANNER)
.addService(googletag.pubads())
.setTargeting('AdType', ['BANNER_ABOVE']);
// BANNER_ABOVE_2
googletag.defineSlot('/21768925892/5860_I000/I0181', [],
'gpt-ad-BANNER_ABOVE_2')
.defineSizeMapping(mapping_BANNER)
.addService(googletag.pubads())
.setTargeting('AdType', ['BANNER_ABOVE']);
/** Request naar Google Ad Manager */
googletag.pubads().enableSingleRequest();
googletag.pubads().collapseEmptyDivs();
googletag.enableServices();
});
/**
* I0178 - Antwerpen
* I0179 - Limburg
* I0180 - Oost-Vlaanderen
* I0181 - West-Vlaanderen
* I0182 - Vlaams-Brabant
*/
}
function getPubCodeByLocation(location, func ) {
// API call voor ophalen van lat en lon
console.log('Ingegeven locatie: ' + location);
var xhttp = new XMLHttpRequest();
xhttp.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 200) {
var jsonResponse = this.responseText;
jsonResponse = JSON.parse(jsonResponse); // JSON object van string maken
console.log(jsonResponse);
var zipcode = jsonResponse['0']['address']['postcode'];
var county = jsonResponse['0']['address']['county'];
console.log('Postcode: ' + zipcode);
console.log('Provincie: ' + county);
var pubCode = '';
switch(county) {
case 'West Flanders':
case 'West-Vlaanderen':
zipcode = 8000; // Brugge
pubCode = 'I0181';
break;
case 'East Flanders':
case 'Oost-Vlaanderen':
zipcode = 9000; // Gent
pubCode = 'I0180';
break;
case 'Antwerp':
case 'Antwerpen':
zipcode = 2000; // Antwerpen
pubCode = 'I0178';
break;
case 'Limburg':
zipcode = 3500; // Hasselt
pubCode = 'I0179';
break;
case 'Flemish Brabant': // Leuven
case 'Vlaams-Brabant':
zipcode = 3000;
pubCode = 'I0182';
break;
default:
zipcode = 1000; // Brussel
pubCode = 'I0182';
}
console.log('Te retourneren pubCode: ' + pubCode);
func(pubCode);
}
return pubCode;
};
xhttp.open(
'GET',
'hidden link' + location + '?format=json&addressdetails=1&limit=1',
true
);
xhttp.setRequestHeader('Content-type', 'application/json');
xhttp.send();
}
</script>
<!-- End Google Ad Manager -->
So the upper script is loaded between the <body>-tags instead of the <head>-tags where it should be. Custom CSS and JS PRO support told me that it's causes by the double <style><style></style></style> tags:
<style><!--[if IE 7]><style>.wpv-pagination { *zoom: 1; }</style><![endif]--></style>
Can this be fixed?
Or can we temporary remove that style code so I can do an additional test? We're not supporting IE7 anymore, so it's not that bad if the code doesn't exist anymore...