Skip to main content
All CollectionsProject SettingsCustom Snippets
How to set up your own Custom Snippets
How to set up your own Custom Snippets

Introducing our new Custom Snippets feature, including custom fields and custom counts!

Berislav avatar
Written by Berislav
Updated over a year ago

Imagine you need to change a single piece of information, e.g., your address on your website. Do you know on how many of your pages this information can be found? And how do you make sure that you changed the address on every single page? Would you execute that task manually? Which - to be honest - would take you foreeeever. Absolutely not! There are better ways to use your precious time. Good news: We are here to help you solve that task in no time with our new feature Custom Snippets.


Overview


How to get started

Go to your “Project Settings”. Please note: To do so, you must be an Account Owner or Project Manager.

Click on “Custom snippets”.

Choose an analysis option: Custom Fields or Custom Counter.

Following our use case from above on changing the address, we would opt for Custom Counter to find out on how many pages the Ryte address can be found.

You can now name your Custom Counter, select a mode and add the selector. When creating a Custom Counter, you can choose from four different mode options, while for Custom Fields you can select from six different mode options.

Regex: A regex, short form of regular expression, is a string of characters (e.g., text, words, sentences) that form a pattern and helps to find and match similar text, words, or sentences. The mode options “Search in text” or “Search in HTML” indicate in which form the text should be searched for.

XPath: The XML Path Language is a query language to evaluate parts of an XML document. The mode options “Get text only” or “Get complete tag” indicate if you just want to copy the sole information (e.g., address) or the entire span-tag (<span>).

CSS: CSS is a programming language which is used for the visual design of a website. The mode options “Get text only” or “Get complete tag” indicate if you just want to copy the sole information (e.g., address) or the entire span-tag (<span>).

Let’s do three examples for Custom Counter:


1. Regex - Search in text

First, name your Custom Snippet. Choose a name that indicates all important information, so you will later easily be able to find the Custom Snippet.

Second, choose your mode and add your selector.

For “Regex: Search in text” go to your website and copy the address.


2. XPath - Get complete tag

Same as above, start with naming your Custom Snippet.

Second, choose your mode and add your selector.

For “XPath: Get complete tag” go to your website and open the menu with a right click.

Select "Inspect" and find your address.

Right-click on the address to open the menu, select “Copy” and click on “Copy XPath”.

Paste into the selector field.


3. CSS path - Get text only

Same as above, start with naming your Custom Snippet.

Second, choose your mode and add your selector.

For “CSS path: Get text only” go to your website and open the menu with a right click.

Select "Inspect" and find your address.

Right-click on the address to open the menu, select “Copy” and click on “Copy selector”. Note: This is the process applied when using a Chrome Browser.

Paste into the selector field.


4. More Custom Fields & Custom Counter examples

After saving your Custom Snippet, you have to start a new crawl to see your results and work with them. After the initial crawl, the Custom Snippet will also be included in every consecutive analysis. In case of multiple projects, such as different country domains or a mobile and desktop version of your site, you need to create a Custom Snippet for every project. So far, you can create a maximum of 10 Custom Fields and 10 Custom Counters per project.

To verify that your query finds results, you can perform a test run with the Test Selector before starting a new crawl.


Did this answer your question?