How to use the Custom Code block in XMS Systems

How to use the Custom Code block in XMS Systems

What the "Custom Code" block is for and how to use it in XMS Systems
Advanced Feature...

What the Custom Code block is for.

When you really start to work your website, you will most probably come across a case where you need to implement some tracking code or want to add some custom jquery function to a specific page you will need this block.

As an example, I was implementing “trust pilot” into a website the other day and had to verify that I own the website by inserting a <meta> tag in the <head> section of the page. If I didn't’t have access to the “Custom Code” block I would have had to manually inserted the bit of code into the actual script. That means every time the website gets upgraded, the bit of code had to be re-inserted into the program. Good chance of forgetting about it and “trust Pilot” stopping from working.

Another example is if I need to have some jquery code running on this one specific page. It is a bit pointless to include it in the site wide scripting page because that will then load and execute on all of your pages.

How to use the Custom Code block?

Firstly, if you not sure what you about to do, then ask. You could potentially break your website.

If it is a case of adding a meta tag… Simply copy and past the complete tag as given to you. as an example the “Trust Pilot” tag looked like this.

<meta name="trustpilot-one-time-domain-verification-id" content="428L0OvYSGJ4567GJ948576GJGFCLxpgnnF"/>

If you need to display an alert when the page is loading you will use jquery to do so.

Here is a short example of such a script.

<script>
$(document).ready(function(){
   alert('Hello and welcome to our website!');
});
</script>

When adding some script you need to make 100% sure you script is valid “programming” as we do not validate what you add into that block. The only thing we do is to check at server level if you trying to do something bad by adding a script that will potentially compromise your website or spreading a virus/worm to your users.

If the security software on the server thinks you are trying to do that you will receive an error and your website will immediately stop working.

Once you successfully added your meta tag or script the block of code will be added to the website page every time it is displayed on your visitors browser.

Written by:  - 6 Jul, 2017  
comments powered by Disqus
flashy