How to use Getsitecontrol API

❗This is an advanced feature that requires some programming knowledge. Please note that the use cases below are just examples you can use to tailor the code to your needs.

API: general information

First, to be able to use the Getsitecontrol widget API, you need to add the main script to your website.

Next, add the code snippet that will define the global gsc() function. Here it is:

<script>  
  window.gsc=window.gsc||function(){
    (gsc.q=gsc.q||[]).push(arguments)
  };
</script>

Place this script as high in the code of the page as possible. This will allow the Getsitecontrol API to function regardless of whether the main script has finished loading.

The global gsc() function provides a base interface for almost anything you may want to achieve with the Getsitecontrol widget API.

How to display widgets based on your site logic (e.g. button clicks)

You can configure your widget to appear when a site visitor performs a certain action on your website. For example, clicks a ‘contact us’ button, adds an item to the cart, etc.

Here are the steps you need to take.

1. Adjust the widget settings

Open your Getsitecontrol dashboard, find the necessary widget on the list, and click Edit.

Then, switch to the Targeting tab and find the ‘Start displaying widget’ section.

If you want this widget to appear on your site only when triggered via a button click, remove all the conditions from this section.