Targeting: Serving Different Widgets with Conditional Logic

Written by Britain Southwick Updated over a week ago

Friendbuy lets you deploy widget targeting so you can serve different widgets to your users based on certain criteria. For example, display Widget A on the order confirmation page if the user purchases a promotional product, otherwise display Widget B.

Follow these simple steps to achieve this functionality.

Step 1:

Create the two widgets in your Friendbuy account (i.e. Widget A and Widget B).

For the sake of this tutorial, let’s consider we have these two widgets.

Notice above that we are passing in .friendbuy-post-purchase-widget (which is the CSS selector of the div where we want the widget to pop-up) as the third parameter. There are further optimizations possible within this approach, such as assigning the widget ID to a variable and populating its value based on the condition.