Owner: techops@choozle.com
Updated: 5/14/24
Setup Instructions:
Use these steps before you publish or export your HTML5 assets from Google Web Designer:
Insert the script below into step 3 above.
<script type="text/javascript">
function getParameterByName(name) {
name = name.replace(/[\[]/, "\\[").replace(/[\]]/, "\\]");
var regex = new RegExp("[\\?&]" + name + "=([^&#]*)"),
results = regex.exec(location.search);
return results === null ? "" :
decodeURIComponent(results[1].replace(/\+/g, " "));
}
var clickTAG = getParameterByName("clickTAG");
</script>
Creative isn’t clicking through
<script type="text/javascript" gwd-events="handlers">
gwd.clickTAG = function(event) {
function getParameterByName(name) {
name = name.replace(/[\[]/, "\\[").replace(/[\]]/, "\\]");
var regex = new RegExp("[\\?&]" + name + "=([^&#]*)"),
results = regex.exec(location.search);
return results === null ? "" :
decodeURIComponent(results[1].replace(/\+/g, " "));
}
window.open(getParameterByName("clickTAG"));
};
</script>
Creative isn’t tracking clicks
Similar to the previous example—simply add the following script just above the closing </head> .
<script type="text/javascript" gwd-events="handlers">
gwd.clickTAG = function(event) {
function getParameterByName(name) {
name = name.replace(/[\[]/, "\\[").replace(/[\]]/, "\\]");
var regex = new RegExp("[\\?&]" + name + "=([^&#]*)"),
results = regex.exec(location.search);
return results === null ? "" :
decodeURIComponent(results[1].replace(/\+/g, " "));
}
}
</script>
Click Through URL is Hard-Coded
We need to find all instances of the click-through url and replace with the "clickTAG" value:
Additional Resources:
- https://support.google.com/webdesigner/answer/9219186?hl=en