Product Requirements |
Privy's audience targeting rules are a collection of conditions that allow you to target individuals with specific campaigns so that you can display the right message, to the right person, at the right time. This guide reviews how to leverage some custom JavaScript to show a campaign to individuals who are or are not logged in during their visit.
Note: The steps outlined below are provided based on the assumption that you've already created a Convert campaign that includes an onsite display (e.g., Popup).
Target logged-in visitors
To add a targeting condition that will only show the campaign to visitors who are logged into their Shopify account for your store:
- Navigate to the Convert > All Campaigns via the main navigation.
- Select or create a campaign and navigate to the Target step in the campaign builder.
- Select the Who To Show It To section and then the Add targeting condition button.
- Select the Custom JavaScript option from the Property dropdown menu.
- Paste the code listed below into the Value field.
if (window.__st) { return (__st.cid != null);
} return false;
- Click the Save button to lock in your new targeting conditions.
That's it! Your campaign will now only include visitors who are logged into their store accounts.
Target logged-out visitors
To add a targeting condition that will only show the campaign to visitors who are logged out of their Shopify account for your store:
- Navigate to the Convert > All Campaigns via the main navigation.
- Select or create a campaign and navigate to the Target step in the campaign builder.
- Select the Who To Show It To section and then the Add targeting condition button.
- Select the Custom JavaScript option from the Property dropdown menu.
- Paste the code listed below into the Value field.
if (window.__st) {
return (__st.cid == null);
}
return true;
- Click the Save button to lock in your new targeting conditions.
That's it! Your campaign will now only include visitors who are logged out of their store accounts.