Sign in

Welcome.
How can we help?

How can I force the script to load?

Topic: , Updated:

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, there is a possibility for the webmaster to choose when the script should be loaded by sending a configuration parameter to the script which blocks the auto load function. This 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 auto load 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>
Was this article helpful?
0 out of 0 found this helpful

Comments


Not the answer to your question?

Powered by Zendesk