I am trying to host the JS files linkid.js
and analytics.js
locally in our dedicated CDN server.
right now we are referencing to both files as follow:
(window,document,'script','//www.google-analytics.com/analytics.js','ga')
and
ga('require', 'linkid', 'linkid.js');
is it easy for me to change the URL reference for analytics.js
but i am not sure if I can do that for linkid.js!
Looked for documentation but couldn't find an answer if it accepts a relative URL or not. How to handle this situation
EDIT 1: The reason why i need to do that:
Due to security reason, the require command doesn't allow you to source random script tags; Only the official plugins and locally hosted.
You will have to add another tag to your page:
<script async src="https://mycnd.com/linkid.js"></script>
and then use:
ga('require', 'linkid', 'https://mycnd.com/linkid.js');
Setting the url in the 3rd param will trip the security settings and prevent it from loading. The plugin will get loaded once the tag loads.
Do you really need to host it on your own CDN? Mind sharing your reasons?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With