Do a lot of pools or content harm my website performance?

Search & Replace Script

I do have many pools on my site or a lot of content on my site, does this harm the script performance?

If you have a website with a lot of pools/search texts (>400) and/or with much content (DOM Elements) our script will need more computing cycles to complete the search & replace. In some cases this can lead to unwanted behavior.

To get ahead of this issue you can use the "getNumberBySearchtext" method within the matelso script. Using this method you can fetch a call-tracking number by it's search text from a script within the page. After fetching the number the user script has to place the number within the DOM. Using this method we can skip the search within the website content, which can increase the performance.

How to use the "getNumberBySearchtext" method?

In order to be able to use the "getNumberBySearchtext" method, the Matelso script must be installed on the page and I also have to define a callback method. This callback method is called by the Matelso script as soon as the call tracking number is available. If an error occurs when retrieving the phone number, the error message is passed to the callback method. .


Two parameters are passed to the callback method :

- numberObject: This object contains the call tracking number in different formats. (e164, formatted according to CP configuration and as Tel-Link)
- errorString: A text containing the error message should an error have occurred.

Following is an example of the callback method:

var callback = function(numberObject, errorString){
console.log('getNumberBySearchtext failed:', errorString);
// Do something with the number here

Missing within this example is the logic to place the number within the DOM. This needs to be implemented by the website administrator.

After fulfilling those requirements you can call the method using the following example snippet:

window[window.CallTrackingObject]("getNumberBySearchtext", "{SUCHTEXT}", callback);

Within this example you can see {SEARCHTEXT} as a placeholder for the search text you want to use to fetch the call-tracking number.