What is Custom-script in Frontman’s Story Builder Utilities Section?

Custom-script feature gives you access to run tracking codes of the service providers like Google and Facebook. With this, you can track if a user has performed a specific task or not.

Execute custom code menu.

What is the Function of the Custom Script?

Here, in Frontman a custom script is a javascript code, that can be used to mark the completion of a specific task by the visitors. Such as, if a visitor has provided you with the personal details. Then by using custom script, you can choose to redirect a user to a specific web-page, such as offers page, get prime membership page, redeem offers/coupons page, or any other interactive web-page which you want to show to a specific audience.

What are the Use Cases of Custom Script?

Custom script card allows you to execute custom codes that are specially tailored to run after a specific user action, such as:

1) To open a website or webpage in a new tab after completion of a particular action. Use this code:

window.open("https://gymmakerobos.multiscreensite.com/studio", "_blank")

2) To redirect visitors to another website or webpage after completion of a particular action, use this code:

window.location.href="https://gymmakerobos.multiscreensite.com/studio"	

Note: Change the URL to the one where you want to overshoot the website visitors.

3) To send visitors a custom message after completion of a particular task, or while sending offers, alerts. Use this code:

alert("Hello World");

Note: Change the quoted message with the one that you want to display at the top of the website.

4) To hide Frontman after a specific action. Use this code:

setTimeout(()=>{
    mkos.mr_toggle()
},2000)

Note: Here, 2000 represents a 2 seconds delay. And, after it, Frontman will hide. You can change the numbers accordingly, or you can use the “Typing delay” function.

5) Get user information in Google Analytics by using this code:

To get the information regarding generated leads and user-submitted information in your Analytics dashboard. Paste the below code into the custom script section.

The main purpose of this code is to filter out the genuine customers out of the total website visitors.

Note: You should first install the Google Analytics script on your website. Otherwise, no user data will be sent to the Analytics section through this code.

ga('send', {
  hitType: 'event',
  eventCategory: 'Lead Generation',
  eventAction: 'Submitted Credentials',
  eventLabel: 'Leads'
});

6) To permanently hide Frontman for website visitors after a specific response or task. Use this code:

  mkos.uninstall() 

Note: Place this code into the custom script card. It will hide Frontman for the user till session ends. When the same user will revisit the website then your bot will be there for assistance.

For instance, below is the conversation between Frontman and a visitor. Here, if the visitor in response to the “Can I assist you?” had said “NO” instead of “Yes” then the bot will be uninstalled for the specific users.

7) To scroll down visitors to the bottom of a page. Use this code:

$(document).ready(function()
   {
   $(document).scrollTop($(document).height());
   });

Note: As this code brings down the visitors to the bottom of the page, you should run it by using RUN-IF card. Take user input and save it as an attribute, then match the attribute with the condition to take a visitor to the bottom of your website.

8) Show a pop-up to abandoning visitors. Use this code:

var mouseX = 0;
var mouseY = 0;
var popupCounter = 0;

document.addEventListener("mousemove", function(e) {
    mouseX = e.clientX;
    mouseY = e.clientY;
    document.getElementById("coordinates").innerHTML = "<br />X: " + e.clientX + "px<br />Y: " + e.clientY + "px";
});

$(document).mouseleave(function () {
    if (mouseY < 100) {
        if (popupCounter < 1) {
            alert("Please don't close the tab!");
        }
        popupCounter ++;
    }
});

Apart from these, you can also use Custom script card:

  • To hide the Frontman after the conversation ends.
  • To start a remarketing or conversion script.
  • To start custom codes by Google, FB, Quora, or any other service provider.

Note: Javascript codes can be embedded into the websites.
:Custom-codes can’t be previewed using preview fucntion.

Custom-script function is only available in “Business” and “Enterprise” plans.

Makerobos Help Center