Trying to Change when Javascript Loads for two plugins

I have two plugins that load - Social Media Icons and OIO PUblisher Banner Ads. The banner ads load in the Pro Sites Advertising space after each post. The Social Media Icons load between the content and the advertising area. The javascript for these plugins has a conflict. I have tried adding the following code:

/*function to add async and defer attributes*/
function defer_js_async($tag){

$scripts_to_async = array('zones.js', 'SGMB.js', 'sg-analytics.js');

#async scripts
foreach($scripts_to_async as $async_script){
	if(true == strpos($tag, $async_script ) )
	return str_replace( ' src', ' async="async" src', $tag );
return $tag;
add_filter( 'script_loader_tag', 'defer_js_async', 1 );

It doesn't work on all browsers. It works sometimes, but not all the time. And, it breaks the back end. So, I tried loading it using the 'wp_head' hook and this helps with the back end, but the front end only works sometimes. This is very strange. The script doesn't load all the time. The banners are coming from a different url using javascript.

Please check the subdomain (hidden)