How to populate a campaign with content from a jQuery selector

Use a jQuery selector to pull live content from any element on your site and drop it into a Digioh campaign, so the campaign reflects whatever page the visitor is on.

A common example: a WordPress blog where every post has a category. Use the category as the selector source, and a visitor reading a post in the Features category sees a sign-up campaign that calls out Features in the headline.

What you’ll learn

  • How to find a jQuery selector for the content you want to pull in
  • How to add a Dynamic Item to a campaign that uses that selector
  • How to choose which field in the campaign gets updated, and how to set a fallback

Find the jQuery selector

  1. Open your site in a browser and right-click the element you want to pull content from, then choose Inspect.
  2. In DevTools, find the markup for the element and identify a class or attribute that uniquely targets it. For a WordPress category link, that’s usually .cat-links a.

use dev tools to find the category jquery selector

Add the dynamic item to your campaign

  1. From the campaign list page, select Add Dynamic Items under the additional options for your campaignDynamic items can be added to a campaign via the additional configuration options
  2. Click +New Dynamic Item.
  3. Configure the fields described in the next section, then save.

Configure the dynamic item

Each dynamic item connects a source on the page to a field inside your campaign. Here’s what each setting does and what to enter for the WordPress category example:

Source

Where the value comes from. Options: jQuery, URL Parameter, URL. For this example, choose jQuery.

jQuery Selector

The selector to read from. For this example, enter .cat-links a.

jQuery Method

Determines exactly what information is being "pulled" from the element you targeted with your jQuery Selector. For this example, select 'text' to retrieve the text value of the .cat-links a selector.

Operator

How the source value should be matched. This example uses Equals; the dropdown also includes Contains, Starts with, and others.

Comparison

Whether matching is case sensitive. Choose Case insensitive if capitalization shouldn’t affect the match.

Source Value Matches

What the source value has to be for this rule to fire. Choose Anything to match every value the selector returns, or Custom to limit the match to a specific value.

Target

The field in your campaign you want to update. You can target text fields, image fields, HTML, buttons, and custom fields.

Target Page

The page in your campaign that contains the target field. This example uses the Main Page.

Target Fill

What to display in the target field. Choose Source Value to display the value pulled from the selector, or Custom to display fixed text.

Target Fallback Value

What to display if the selector returns no value.

Want to get more from Digioh?

Get the playbooks leading brands use to convert more visitors into revenue.

Browse the Playbooks ?

Platform Tour

See what else you can do with Digioh in our self-guided platform tour.

Take the Tour ?

Still Need Help?

Connect with our team for technical help.

Message Support