Custom Targeting Parameters

In some cases, you may want to extend the targeting abilities of a popup. Perhaps you want to only show a popup to users that are already logged in or have not confirmed their email address yet or who view your site in dark theme. These conditions are not easily targeted by the options that popup provide but can be by custom targeting parameters.

To use custom targeting parameters, start by creating or editing a popup of any type in GatorPopup and go to the Targeting tab. 

Here, make sure you have checked “The following conditions” in the “Who would you like to see your popup” section. Scroll to the bottom of these options and find the section titled “Custom Targeting Parameters”. Click the button to add a new parameter.

Set the parameter name in the first input, this can be any value, make a note of this value as we will need it later. Then set if you want “Equal To” or “Not Equal To”. Then set the value of the parameter.

Once you have set the Custom Targeting Parameters on the popup, you need to tell the Popup API about the values. This requires adding some JavaScript to your own website, where you want the popup to show.

Use the below function to tell the script about the values. Pass the function an object with group, key, and value as properties. The key should match the Parameter Name you set in the popup edit page. For targeting parameters, make sure the group is set to “targeting”.

_gl.p.pushData({group: “targeting”, key: “foo”, value: “bar”});
Click to copy

In case you are using multiple targeting parameters in a popup or multiple popups on a page, use the same function but provide an array of objects instead, like the below example.

_gl.p.pushData([
	{ group: ”targeting”, key: “foo”, value: “Foo” },
	{ group: “targeting”, key: “bar”, value: “Bar” }
]);
Click to copy

Once you have provided these values to the Popup API, your popup should now start making use of these parameters. This functionality allows you to really extend the targeting system and get creative with when it’s displayed.

Refer to the API reference for more information on the Popup JS API by clicking here