Academy

ContentKing monitors all important SEO elements on your pages, such as title, meta description, canonical link, etc. With our Custom Element Extraction, you can define what additional elements you want to keep track of.

Example use cases

The beauty of custom element extraction lies in its flexibility - you can create any custom element you need. You can let your imagination run wild, or get some inspiration from these example use cases we have seen the most.

Author of the article

Does each of your pages have an author who is responsible for keeping it up-to-date? Set up a custom element Author, and then you can create a new segment for each author so that everyone knows which pages they need to keep their eye on.

Screenshot of a columns with a custom element Author on Pages in ContentKing

Publication date

Are you trying to find out how many articles were published in a specific month on your website? Create a custom element for the publication date of each page and then easily filter on it on Pages to see how much content was produced in the past months.

Screenshot of a columns with a custom element Published on Pages in ContentKing

Date of last update

Do you want to make sure that you don’t have any outdated content on your website? Start tracking the date of last update on each page and then filter on it on Pages to find pages that need a little touch of freshness.

Screenshot of a columns with a custom element Last updated on Pages in ContentKing

Out of stock products

Do you manage an e-commerce website and need to make sure that all products listed are in stock? Create a custom element for the Out of stock label and easily search for it on all pages.

Screenshot of a columns with a custom element Out of stock on Pages in ContentKing

Empty category pages

Do products listed on your website often change? Set up a custom element for No results in this category and quickly find empty categories that can be removed.

Screenshot of a columns with a custom element Empty category on Pages in ContentKing

Are you curious which products have the highest review score? Create a custom element for products with five star score and then filter on it on Pages to search for the most popular products on your website.

Screenshot of a columns with a custom element Review score on Pages in ContentKing

Custom Element Extraction in ContentKing

Setting up custom elements is only the first step. More important is what you can do with them:

  1. Filter on them on Pages
  2. Create segments based on them
  3. See how they changed over time in Change Tracking on Pages
  4. Investigate how they changed on a single page in more detail in Tracked Changes on Page detail
  5. Use segments based on them to create more targeted alerts
  6. Filter on segments based on them to audit specific part of your website in Issues

How to create a custom element

Not 100% sure how to set up a custom element? Go through this step-by-step guide to learn more.

  1. Go to Account and click on a website you want to create a custom element for
  2. Go to Custom elements section
  3. Click on Create custom element
Screenshot of Website Settings in ContentKing

Setting up a custom element

Screenshot of creating custom element in ContentKing

Setting up a custom element consists of these steps:

Choose an element name

Choose a name that describes the element the best, e.g. Author for the author of the article or Last updated for the date of last update of the page.

Screenshot of an Element name for a custom element in ContentKing

Tip: Keep names of your custom elements consistent across websites so that ContentKing knows they are related. That way, when you filter on a column for a custom element on one website and switch to another website that has a custom element with the same name, the value in the filter will carry over. The same applies to reordering the columns in the Custom elements section of Manage columns.

Define extraction steps

Define extraction steps using XPath, CSS selectors or regular expressions. At least one step is required, and you can define up to 6 extraction steps by clicking Add another step. ContentKing processes these steps sequentially in the order you defined, meaning the result of the first step serves as an input for the second step, and so on.

For each extraction step, choose:

Method

You can choose XPath, CSS selector, or a regular expression.

Screenshot of a choosing an extraction method for a custom element in ContentKing
Expression

This is where you specify the expression of the selected method, e.g.

  • XPath: /html/body/p[1]
  • CSS selector: .user-overview__name > span
  • Regular expression: /([0-9])/

ContentKing uses PCRE to evaluate regular expressions. Check out this cheat sheet to learn more about the required format.

Choosing an Expression of an Extraction step of a custom element in ContentKing
Occurrence

Here you can specify which element on the page should be extracted if ContentKing finds more elements on the page that conform to the extraction expression. E.g. if a paragraph is about to be extracted, here you define whether you want to extract the first paragraph, second paragraph, etc.

If you leave the Occurrence set to All and won’t use any transformation that requires it (see below), only the first occurrence of the element will be extracted.

More extraction steps

Combining XPath and CSS selectors is not supported. If you want to use one of these methods for extraction, set it in the first extraction step. All following steps need to be defined using a regular expression.

Choose element type

As the next step, choose whether you want ContentKing to look for a string, a number, or a date. This is important not only for the extraction, but it also helps ContentKing to decide which filter to use on the column for this custom element on Pages.

If you choose a string, you can select these optional transformations of the extracted element:

  • Remove excessive whitespace: this will remove excessive whitespace in the extracted element, e.g. ` Jake Brown ` will be turned to Jake Brown
  • Replace HTML entities: this will replace HTML entities by the corresponding characters, e.g. & will be replaced by &
  • Strip away HTML markup: this will remove all HTML tags, but their text content will be kept, e.g. <p><span>Jake Brown</span></p> will be turned into Jake Brown
  • Drop empty values: if the extracted element does not contain any character, it will be considered not found
String set as an an Element type of a custom element in ContentKing

If you choose a number, also specify the format of the number on your pages so that ContentKing can correctly recognize it. This is different from the format in which the number will be displayed in the app, as that depends on the Language in your User Settings.

Choosing *number* as the element type of a custom element in ContentKing

If you choose a date, also specify the format of the date on your pages so that ContentKing can correctly recognize it. This is different from the format in which the date will be displayed in the app, as that depends on the Language in your User Settings.

Choosing *date* as the element type of a custom element in ContentKing
Tester

Before saving the element, you can use the tester to test the result of the extraction on a specific page.

Screenshot of a tester of a custom element in ContentKing
Transformations

You can also specify additional operations to be applied to the extracted element before saving it. Just click on Add transformation and choose a transformation you need. You can define up to 6 transformations.

Screenshot of adding a transformation of a custom element in ContentKing

Count number of elements

Use this to get a number of extracted elements, e.g.

  • Extracted elements: James Anna Kim
  • Result: 3

Set occurrence of the extraction steps to All to extract more than one element.

Measure length of string

This will compute the number of characters of the extracted element, e.g.

  • Extracted element: There are many different things which can break in SEO – sitemaps, meta information, page relationships, links… With ContentKing I feel like we’re finally in control of all of this.
  • Result: 183

Prepend

This transformation adds a string before the extracted element, e.g.

  • Extracted element: 9.90
  • String to prepend: $
  • Result: $ 9.90

Append

This will add a string after the extracted element, e.g.

  • Extracted element: 9.90
  • String to append: ` EUR`
  • Result: 9.90 EUR

Replace

This will replace a part of the string by another string, e.g.

  • Extracted element: North Carolina: Raleigh
  • Search for: North Carolina
  • Replace with: NC
  • Result: NC: Raleigh

Truncate

This transformation limits the string length to the specified number of characters, e.g.

  • Extracted element: 4.9 out of 5
  • Max. length: 3
  • Result: 4.9

Concatenate

This transformation will join extracted elements into one string, e.g.

  • Extracted elements: James Anna Kim
  • Separator: ,
  • Result: James, Anna, Kim

Set occurrence of the extraction steps to All to extract more than one element.

Regular expression

Use this to apply a regular expression to the extracted element. Result of this transformation will be an extracted element where the output pattern was applied to the characters found by the input pattern.

This transformation can act as other transformations, such as replace, append, prepend, truncate or concatenate.

Compute MD5 hash

This will uniquely concatenate all elements and compute an MD5 hash.

Start your free 14-day trial

Get up and running in 20 seconds

Please enter a valid domain name (www.example.com).
  • No credit card required
  • No installation needed
  • No strings attached