-
Notifications
You must be signed in to change notification settings - Fork 0
How to check input words for product matching algorithm
Billy T. Hernandez edited this page Dec 23, 2020
·
2 revisions
Follow these steps to see what words are being sent back to our product matching algorithm
Go to a shopping page Open the console in Developer tools (command + option + i)
Paste this code into the console
var identifyProduct = function() {
productName = "";
// gets all html elements that are images and have an ancestor with a classname that includes the word product
const productElements = document.querySelectorAll("[class*='product'] * img");
if (productElements[0]) {
// .alt is the alt text for the image
productName = productName + productElements[0].alt + " ";
}
productName = productName + document.title;
console.log(productName);
}
Hit enter
type identifyProduct()
Hit enter