Hi, my client has asked me to insert some Javascript which enables him to be verified for an affiliate scheme that he has joined. The company who he has become an affiliate for has asked him to insert some javascript before the closing body tag of his site’s template.
The code looks like this:
<script type="text/javascript">
var vglnk = {key: '5643e4a94bhdstswd0add591eb68sh8tw8h'};
(function(d, t) {
var s = d.createElement(t);s.type = 'text/javascript';
s.async = true;s.src = '//cdn.viglink.com/api/vglnk.js';
var r = d.getElementsByTagName(t)[0];
r.parentNode.insertBefore(s, r);
}(document, 'script'));
</script>
Can I simply add it to the Global JS in the Theme options? Or do I need to add it to the Child theme’s function.php file. If it needs to go in the function.php file, what is the accompanying code that I require in order to insert the javascript?
Many Thanks
Lewis