You can find general instructions on how to work with GetSiteControl API here.
You can use API targeting to display widgets based on certain information or properties in your web application logic.
Let’s say we want to target female paid users only. We should add the following method call somewhere in our template code after the GetSiteControl script to pass the necessary parameters to GetSiteControl API.
_gscq.push(['targeting','isPaid', '<%= user.isPaid %>']); _gscq.push(['targeting','sex', '<%= user.sex %>']);
<%= …%> is an example of a template tag.
This code will set two parameters for widget targeting: isPaid and sex.
Then we need to configure the widget to understand these parameters. Open the necessary widget and switch to the Targeting tab. Choose the option visitors who meet the conditions below under Who should see this widget?, scroll down and click the + Add API parameter link.
Enter your custom parameters. In our example user.isPaid is a boolean value and user.sex can be male or female.
Click OK to save the changes.
That’s it! This widget will now be shown to female paid users only.