<script type="text/javascript">
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
</script>
<script type="text/javascript">
try
{
var pageTracker = _gat._getTracker("xx-xxxxxxxx-x");
pageTracker._setDomainName(".com");
pageTracker._trackPageview();
} catch (err) { }
</script>
<script src='bla.com/gaAddons.js' type='text/javascript'></script>
我在多个文件中有这个旧的谷歌分析代码。我需要将上面的整个代码替换为<script src='external_file.js' type='text/javascript'></script>
.
我正在使用 php,这是我的正则表达式:/<script.*>.*<script src='.+gaAddons.js' type='.+'><\/script>/
它不起作用并且存在问题。