Integrate URL Freezer using Javascript

Here is a simple guide to how to integrate URL Freezer in your website just using javascript, as start the first thing to understand is what are you using to build website, if you are just using static html and javascript, we would suggest to use our direct script, if you are using a package management system, we would suggest to use the published library on npm, so let's see how to do it in both cases:

Direct Javascript

If you are using just plain html and Javascript on your site, you may just want to link the script that we provide in your page, here is an example snippet of code that you can use to integrate it:

<script type="text/javascript">
let url = 'https://urlfreezer.com';
var _pars = _pars || {};
_pars["user"] = 'YOUR_USER_ID_FROM_INSTALL_PAGE';
_pars["url"] = url;
(function() {
	var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0];
	g.type='text/javascript'; g.async=true; g.defer=true; g.src=url+'app/urlfreezer.js';
	s.parentNode.insertBefore(g,s);
})();
</script>
                

You just need to replace "YOUR_USER_ID_FROM_INSTALL_PAGE" with the User Id from the install page , as well in the install page you will find the complete script already filled with parameters

NPM published Library

if you are using a package management like npm you can use the URL Freezer Library to do that you can just do "npm install urlfreezer" and that will add the library than in your page code you just need to add the following code

import {URLFreezer} from 'urlfreezer'
let urlFreezer = new URLFreezer('##YOUR_USER_ID_FROM_INSTALL_PAGE##')
// This will look for all the links in a page and replace with urlfreezer links when needed
urlFreezer.replacePageLinks()
                

You just need to replace "YOUR_USER_ID_FROM_INSTALL_PAGE" with the User Id from the install page ,