Script мanager

Overview

When building complex web sites, you often need to use third-party JavaScript code to integrate services, such as customer analytics. You integrate services such as Google Tag Manager (GTM) or Adobe Experience Platform, which enable you to quickly and easily update measurement or other code fragments on your sites without touching the content. They can be a valuable marketing tool, in addition to Sitefinity Insight.

In this article, you learn how to integrate external scripts, such as GTM on your Sitefinity CMS sites.

NOTE: When you change the script configuration, whether adding, editing, or deleting a script, Sitefinity CMS invalidates the output page cache for all affected sites. This can reduce the performance until the cache is rebuilt. For more information, see Output cache.

Add a new script to Sitefinity CMS

Perform the following:

  1. In Sitefinity CMS backend, navigate to Administration » Settings » Script manager.
    The Script manager screen opens.
  2. If there are existing scripts, click Plus (Add).
    Otherwise, fill out the required fields.
  3. In Name, enter the name of the entry.
    You use this name to distinguish the script among all other entries in the list.
    For example, enter Google Tag Manger
  4. In Used in sites, select the sites where the script will be served.
    If you want to serve the script on specific sites, click Selected and in the Selected sites column, add the sites you want.
    Otherwise, click All to let Sitefinity CMS serve the script on all sites.
  5. In Scripts, click Edit (Edit).
    The Scripts page opens.
  6. Add the scripts, as instructed by the third-party provider. You can add as many scripts as you need.
    1. To configure Sitefinity CMS to add the script inside the <head> tag of every page, enter them in the Script in <head> tag field. The scripts are added to the end of the <head> tag.
    2. To configure Sitefinity CMS to add the script into the <body> tag of every page, enter them in the Script in <body> tag field. The scripts will be added to the beginning of the <body> tag.

      NOTE: You need to enter a fully formed HTML including the <script></script> tags.

  7. When finished, click Done » Save changes.

Edit and delete scripts

To edit or delete a script inside an existing configuration, perform the following:

  1. In Sitefinity CMS backend, navigate to Administration » Settings » Script manager.
    The Script manager screen opens.
  2. To edit scripts, click Edit (Edit).
    The Scripts page opens, where you can edit the scripts code.
  3. To delete an entry in the script manager, click its Remove (Remove) icon.
  4. Click Save changes.

Configure Sitefinity CMS security to enable requests to third-party web resources

The third-party scripts you use usually make requests to external web domains. By default, Sitefinity CMS security blocks such requests. For the integration to work properly, you need to allow these domains. Perform the following:

  1. In Sitefinity CMS backend, navigate to Administration » Settings » Web Security.
    The Web security page opens.
  2. In Trusted sources, click Edit.
    The Trusted sources window opens.
  3. In Scripts enter the domains you want to allow, one domain per line.
    For example, enter *.example.com
  4. Click Done.

NOTE: Google Tag Manager is automatically enabled as a trusted source. However, if you are updating an existing Sitefinity deployment, you need to manually add its domains as described above.

Want to learn more?

Sign up for our free beginner training. Boost your credentials through advanced courses and certification.
Register for Sitefinity training and certification.

Was this article helpful?