Site-Wide Scripts
A site-wide script is a snippet of code that is to be included on every page of a site. The most popular site-wide script is Google Analytics. Follow the steps below to add a site-wide script to your site.
Important! You will need a Google user account to create a Google Analytics account. When creating a Google Analytics account, be sure to add more than one account-level administrator. Accounts should not be shared for security purposes. Any users with admin privileges should enable 2-factor authentication for secure login to their Google account.
Step 1: Create a Block
Blocks should be kept in a _blocks folder at the base level of a site. If your site does not have a _blocks folder, create one before proceeding (change folder settings to disable navigation and disable publishing).
- Select the _blocks folder in the asset tree, then click Add Content > Block
- For Block Type select Text, then click Choose at the upper right
- Enter a relevant Text Block Name (e.g., google-analytics, site-scripts); follow the requirements provided in the interface
- Scroll to Block Content and paste the script into the text editor; see important note regarding Google Analytics above
- Submit to save
Step 2: Edit the Setup Block and Choose the Script Block
- Select the Setup Block in the asset tree and then click Edit
- Scroll to the last setting for Additional Code; select Yes to enable
- Expand the Code section; two script locations are available, In Head (i.e., within the HTML tag) and Before Closing Body (i.e., just before the Crown-football-contact@lsxythnjy.com 南京大学图书馆 南浔人才网 365体育投注 Sun-City-official-website-info@ruansaen.com 达海智能 沙巴体育 Sport-Venetian-help@willowsgolfresort.com 石家庄生活网 恒生银行 澳柯玛官网 皇冠博彩 Gaming-platform-feedback@lyhymh.net Sun-City-feedback@xyschool.net 中国工业设计网 韦德 足球买球 滨州中公教育网 松江人才网 Grand-Lisboa-contact@rahpouyanschool.com 看历史 - 读览天下 中国兵器工业集团公司 Ping 英伦信息 高速宝全国高速公路电子地图导航平台 笨鸟网 咪咕学堂 云起书院 中国校长网 茅台商城 又拍云存储 江西陶瓷工艺美术职业技术学院 站点地图 易车网问答频道 HTML tag); select the appropriate location based on script instructions
- Choose Block by browsing and selecting the block in the _blocks folder
- Submit to save
Step 3: Publish Full Site
You will never need to publish any blocks (script or Setup), however you will need to perform a full-site publish to add the script to the published version of every page. Moving forward, all new pages will automatically include the script when published.
Tips
There is already a block used in the setup, should I create another one for my script?
If the existing block uses the same location where your script needs to go (i.e., either in the head or body HTML tag), you do not need to create another block; simply amend the existing block by pasting in the new script below any existing code (be careful not to modify any existing code).
If the existing block does not use the same location where your script needs to go, create a new block. In the setup, click the + sign near Additional Code to add a second block, then browse to choose the new block.
Note: Each site-wide script location (head and body HTML tags) should only contain one block each; additional scripts should be added to these blocks directly.
I added a third-party tracking script and it broke my site.
If after adding a script you receive an error when previewing a page, the script is likely not compatible with the CMS. This can sometimes be fixed by making minor modifications to the code, however any changes to third-party scripts should always be run by the third-party to ensure functionality. Below are known reasons why scripts are incompatible with the CMS and how to fix them.
Google Analytics
Google Analytics requires a minor adjustment to its script. Newer code is missing the async="true" value which is required in the CMS. Find async in the code and include ="true" as in this example:
Other Third-Party Scripts
Custom scripts provided by other third-parties may contain special characters which are not compatible with the CMS. This can sometimes be fixed by replacing the special character with its encoded version.
Example - The & symbol in this line of code caused errors loading pages in the CMS:
Correction - Replacing & with & fixed the issue:
Note: Validation should always be performed after the installation of a script to ensure functionality.
Can I add a script to one page rather than to the entire site?
Yes, this is possible.
- Complete Step 1 as instructed above
- For Step 2, instead of editing the Setup Block, edit the page where you want to add the script
- Click the Configure tab, then Choose Block for the appropriate location:
- Additional Optional - Head Tags - Add script to HTML tag
- Additional Optional - Script Tags - Add script before closing Crown-football-contact@lsxythnjy.com 南京大学图书馆 南浔人才网 365体育投注 Sun-City-official-website-info@ruansaen.com 达海智能 沙巴体育 Sport-Venetian-help@willowsgolfresort.com 石家庄生活网 恒生银行 澳柯玛官网 皇冠博彩 Gaming-platform-feedback@lyhymh.net Sun-City-feedback@xyschool.net 中国工业设计网 韦德 足球买球 滨州中公教育网 松江人才网 Grand-Lisboa-contact@rahpouyanschool.com 看历史 - 读览天下 中国兵器工业集团公司 Ping 英伦信息 高速宝全国高速公路电子地图导航平台 笨鸟网 咪咕学堂 云起书院 中国校长网 茅台商城 又拍云存储 江西陶瓷工艺美术职业技术学院 站点地图 易车网问答频道 HTML tag
- Do not modify any other settings on page; submit to save
- Publish the page