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

This is an advanced feature and requires some programming knowledge. Please note that we are unable to provide support for creating or troubleshooting custom code.

Your can configure your widget to be displayed when a site visitor performs a certain action on your website (for example, clicks a ‘contact me’ button, adds an item to cart, etc.).

Step 1

Open your GetSiteControl dashboard, find the necessary widget in the list and click Edit. Switch to the Behavior tab and choose to display the widget programmatically. Please note that once you enable this option all other Behavior and Targeting settings will be ignored. The widget will only be displayed when you call it programmatically.


Step 2

Activate the widget in your dashboard.

Step 3

Use one of the following three methods to trigger the widget.

  • Add the attribute data-gsc-widget to the HTML element on your website, the one that you want website visitors to click to open the widget.

    <a href="#" data-gsc-widget="82297">Open widget with ID=82297!</a>
  • Add this link to the necessary element:

    <a href="#gscw82297">Open widget with ID=82297!</a>
  • Activate the widget using this JavaScript function:

    function showWidget(){
      _gscq.push(['show', 82297]);

82297 in our example is the widget’s ID, so you will need to change it to the ID of the widget that needs to be triggered. To find this ID, open the list of your widgets in the dashboard. The unique ID of each widget is indicated in the lower right corner.