Lumar’s Custom Metrics allow you to quickly and easily collect additional data from your website in the Lumar platform. These metrics include extractions, and you can also perform basic actions based on these metrics, such as:
- Extracting a specific word or phrase, or a specific part of the HTML code (e.g., a specific tag or publish date).
- Creating segments based on data unique to your site.
- Identifying pages missing a specific section or elements (e.g,. pages missing breadcrumbs, or pages without reviews).
- Identifying pages with a specific number of elements on them (e.g., the number of products on a category page, or pages with reviews).
- Capturing all instances of a given URL across the site.
Once you’ve created and collected custom metrics, you can also use them to filter and sort reports, and create custom reports with trend data.
How to Add Custom Metrics in Lumar
Read on for more information about report data visualizations, or take a guided tour.
From the project list, use the ellipses on the right-hand side of the project you want to create a custom metric for, and choose Edit Project.
Go to step 4 of the project setup, and you’ll see a button called Custom Metrics.
If no custom metrics have been created as yet, you’ll see a message saying that you have no custom metrics, and an option to create a metric using the button in the top right corner.
On the next page, you can create up to 5 metrics, allowing you to capture multiple elements within the same custom metric. First, give your first metric a concise name (which will become the column header in reports) and a brief description (which will become a tooltip for the metric in report tables).
Then choose the metric type from the following list:
- String: A sequence of characters. Use this for text content (e.g. titles, names, tags), preserving text exactly as it appears on the page (e.g. “Tag”, “Published Date”).
- Number: A numeric value. This can be used for extracting number metrics, counting occurrences, or tracking quantitative information (e.g. “Number of Tags”, “Days Since Published Date”).
- Boolean: A true or false value. Use this for checking the presence or absence of something, validating specific conditions, or flagging specific characteristics (e.g. “Published Before 2024”, “Contains Tags”).
- Number Array: A list of numeric values. Use this for extracting multiple numeric values.
- Strong Array: A list of text values. Use this for extracting multiple text items, or capturing lists or collections of text (e.g. “Tags”, or “Authors”).
To ease the process of creating custom metrics, Lumar uses AI to generate the code for you. In the Specification area, describe exactly what you want to extract. Use cases include SKU Code, Published Date, Days Since Published Date, 404 wording, Out of Stock Wording, and many more. As you’re probably already aware, results from using AI can vary, so be as specific as possible here to ensure the highest accuracy of the output code.
For example, rather than saying ‘Get the tags’, write something like…
Extract the contents of the meta tag with name of ot:page_type into one page type metric as a string array
example : <meta name="ot:page_type" content="restaurants,poi,food-near-me">
Expect to see Page Types : restaurants poi food-near-me
If you’d like to add more metrics to be captured (up to a maximum of 5), use the 'Add New Metric' button underneath your first metric. As you build out the metrics to be included, you can use the ‘X’ icon to remove any you need to delete.
Once you’ve built out your metrics you’ll need to add in a Primary Test URL. This should be a web page where you know contains the element you want to become a metric.
Underneath this, you can also include up to 10 additional test URLs, which are crucial to making sure the custom metric results are accurate. We recommend using at least 1 negative example (a URL that you know does not contain what you want to become a metric), and any edge cases that might be usefu (e.g. URLs with similar but different elements to ensure your extraction is specific.
For example, if you’re looking to extract article tags, you could include:
- Primary Test URL: An article page with tags.
- Additional Test URL - Negative: Your home page (or another page that does not contain tags).
- Additional Test URL - Edge Case: A different type of content page.
Once you’ve input your first URL, use the ‘Add New Test URL’ button to add more URLs, and the ‘X’ icon if you want to remove any.
Once you have your test URLs in place, click ‘Save & Generate’. Lumar will then save the custom metric, and generate the custom metric. You can see the progress at the bottom of the custom metric area.
Once the custom metric has been successfully generated, Lumar will use the test URLs to show you the result of the extraction, so you can verify that the custom metric is extracting the information you need. If all looks good, you can go back to the custom metrics screen. If not:
- Check that your test URLs are accessible.
- Check you’re using the right custom metric type.
- Make your specification more specific.
- Review any warnings in the results.
- If issues persist, please contact support@lumar.io.
Once you’ve amended the details of the custom metrics, click ‘Save & Generate’ again to retest.
You can also view the raw vs rendered HTML if required, to further validate your custom metric.
The static HTML is shown on the left and the rendered HTML is on the right so you can easily compare the two. Click close when you're done to return to the custom metric.
When the custom metric is saved Lumar automatically gives it a title based on the information being captured. If you want to change this, simply click into the title and rename.
When you go back to the main custom metrics screen, you’ll see the details of the metric you’ve created. From here, you can create more custom metrics (up to a maximum of 25) or use the ellipses on the right-hand side to edit the custom metric or its elements. From the main custom metric, you can also ‘Disconnect’, which will remove the custom metric from the project. Otherwise, if all is good, you can return to the project settings and run a new crawl to extract the information you’ve defined (or wait for the next scheduled crawl to run).
Using Custom Metrics
Once the crawl completes, you’ll be able to add the metric to Lumar reports. All custom metrics are suffixed with an asterisk, so you can use this in the search to find the metrics you need.
Once you’ve added your custom metrics and filtered the reports, you can also then create a custom report to revisit whenever you need from the Custom Reports section in the left-hand navigation. Find out more about creating custom reports.
You can also use custom metrics to create segments. In step 4 of the crawl setup, click on the My Segments button, and then Create Segment. Then, in the drop-down in the segment rules, type the asterisk to find your custom metrics.