|Help Centre

How can I force the script to load?

The Freespee script will wait for the onload or onDomContentLoaded event before it executes the number replacement(s). In practice, this means that if a site takes 2 seconds to load (e.g. before the onload event is fired), and the Freespee script runs in 100ms, it will take 2s + 100ms for number(s) to be changed. If a site takes time to load completely, the implication for a user looking at the page is that they might feel that it takes a long time for the number to be replaced.

To solve this, the webmaster can choose when the script should be loaded by sending a configuration parameter to the script which blocks the autoload function. It means that the webmaster must then manually invoke the script when appropriate (e.g. after the last phone number in the HTML).

First of all, make sure the Freespee JavaScript is placed first in the page by copying it into the <head>.

Then, to disable autoload of the script, set autoInvoke to false by using this example:

__fs_conf.push(['setAdv',{'id': 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'}]);
__fs_conf.push(['autoInvoke', false]);

Last but not least, place this code snippet wisely on your site (e.g. make sure all phone numbers are loaded into the DOM) to manually force the script to load:

<script type="text/javascript">
  __fs_dncs_instance.loadEvent(); 
</script>

Can't find what you're looking for?