In today’s highly competitive market, keeping track of competitor prices provides businesses with crucial insights into pricing trends, customer behavior, and market positioning. For companies aiming to stay agile and responsive, monitoring competitor prices is a powerful strategy. Although numerous third-party tools are available for price tracking, they often come with limitations, such as subscription fees, restricted customization options, or dependency on a particular service’s capabilities.
This guide explores practical methods for setting up your own price-monitoring system, with a focus on how to use XPath. From using Screaming Frog to parse HTML prices, to leveraging XPath for precise element targeting, and even creating a custom Python script to handle both static and dynamic content, you’ll learn how to get accurate price data—without the constraints of third-party tools.
Use XPath for Precise Price Extraction
Step 1: Install the “Scrape Similar” Extension
- Go to the Chrome Web Store, search for “Scrape Similar,” and add the extension to your browser.
- Once installed, the extension will allow you to extract similar elements (like prices) from any webpage.
Step 2: Locate Price Elements on a Competitor’s Website
- Navigate to the competitor’s product or category page where prices are displayed.(We can take the prices of NordVPN – https://nordvpn.com/pricing/ )
- Right-click on a visible price on the page, then select Scrape Similar from the context menu.
Tip: The extension will attempt to select all elements that resemble the one you clicked. If successful, all prices on that page should be highlighted.
Step 3: Adjust and Refine the Data Extraction
- Check the Extraction Preview: The extension will display a preview window showing all the selected elements. Verify that only prices (or your target data) are highlighted.
- Adjust XPath: If the extension pulls unwanted data, you may need to fine-tune the XPath. The preview window usually has options to edit XPath expressions. You can adjust this path to ensure it only captures price elements.
- Copy the Data: Once you’re satisfied with the data selection, click Copy to Clipboard to save the extracted prices.
Step 4: Import Data into Google Sheets
- Open a new Google Sheets document.
- Paste the Data: Select the first cell (e.g., A1) and paste the copied data. Google Sheets will automatically parse the values, arranging them into individual cells.
- Format the Data: If needed, reformat the cells as currency or numbers for consistency.
Step 5: Use IMPORTXML for Static Data in Google Sheets
- If the prices are embedded in HTML and not JavaScript-rendered, you can directly use Google Sheets’
IMPORTXML
function.
- In a Google Sheets cell, type
=IMPORTXML("URL", "XPath")
, replacing URL
with the page URL and XPath
with the specific path to the price element.
- This function automatically fetches data from static HTML pages and can be refreshed in Google Sheets.
Example: =IMPORTXML("https://nordvpn.com/pricing/","//astro-slot/div/div/div[2]/div[1]/div[1]/div/div/div/a")
would retrieve prices from the specified HTML elements if they match this XPath.
Expanding Your Price Monitoring Strategy
For advanced users, integrating Python scripts can automate more complex data collection tasks, especially on pages with dynamic content. By using libraries like Beautiful Soup and Selenium, you can set up scripts that periodically retrieve and store price data in your preferred format.
In conclusion
Monitoring competitor prices has become an essential practice for businesses aiming to stay competitive and agile in today’s dynamic market. By building a customized price-monitoring system, you gain the flexibility to track prices accurately and tailor your approach without relying on third-party tools’ limitations. This guide has equipped you with methods to streamline this process—from using browser extensions and mastering XPath for targeted extraction to automating data collection with Python scripts and Google Sheets. By implementing these techniques, businesses can make data-driven pricing decisions, respond faster to market changes, and optimize their positioning for greater success.