To integrate the Frosmo Platform with your site, you must add two <script> elements to every page of your site. The first element loads the Frosmo Core library (frosmo.easy.js). The second element loads the Frosmo custom script (<site_origin>.js). Frosmo provides the correct script elements to you.

Frosmo script elements in the source code of a web page

Figure: Frosmo script elements in the source code of a web page

You have the following options for adding the scripts to a page:

If your company has multiple sites, add the scripts to each site.

After you've added the scripts to your site, you can check at any time whether the scripts are running smoothly on the site and whether the platform is receiving data from the site. For more information, see Checking site status.

For more information about the scripts, see Technical overview.

Adding the scripts directly to the page source code

To get the most out of the platform, add the Frosmo scripts directly to the <head> element of each page. If you have a large site and need to separately update a lot of pages, use a batch script to automate and speed up the process. If your content management system (CMS) supports global rules or templates, use them to easily add the Frosmo scripts to the page source code.

By default, the scripts are loaded synchronously. Synchronous loading means that the browser waits until the script has been completely loaded before processing the rest of the HTML code on the page. Synchronous scripts placed above the visible content of the HTML document have a greater chance of being executed before the visible content is displayed in the browser. Using synchronous scripts can minimize flickering when displaying modifications.

There are some specific cases where it makes sense to load the scripts asynchronously. Asynchronous loading means that some of the scripts implemented on the page can be loaded simultaneously. For example, when your site has gone through major structural or technical changes, you may want to make sure the pages on your site are loaded properly before loading the Frosmo scripts. However, in most cases, you can work around this by setting event handlers to load the Frosmo scripts at the appropriate moment.

To load the Frosmo scripts asynchronously, add the async=true attribute to the script elements.

Adding the scripts using a tag manager

Using a tag manager typically causes some delay in loading the Frosmo scripts as the native scripts of the site are loaded first. Some tag managers, such as Google Tag Manager, do not allow you to add the scripts to the <head> element, which is the recommended place. Some tag managers also load scripts asynchronously, which makes the Frosmo scripts behave asynchronously regardless of their type.

If the tag manager is set to delay script loading or loads several other scripts before the Frosmo scripts, the page loading speed may suffer. Therefore, even when using a tag manager, make sure that the Frosmo scripts are loaded as early as possible, preferably right after the site's native scripts.