JavaScript Module Guide
Usage Guide
To use the Findmine JavaScript module, first include the script:
<script type="text/javascript" src="//www.findmine.com/findmine-latest.js"></script>
Then call findmine.match
with the required parameters listed below. findmine.match
returns a promise. After completion, call findmine.render
with the ID of the HTML element you want to render findmine into–you must include the jQuery ID selector #
when passing the ID. For example, passing '#findmine-module'
will work while 'findmine-module'
does not.
Example:
findmine.match({ /* params */ }).then(function () {
findmine.render('#findmine-module')
})
Required Parameters
application
(string): The application parameter is a unique identifier provided to you at the start of integration. This identifier is not an authorization secret - it is safe and required to embed in your public HTML.Example:
application: "AB1212CDABCD"
Don't know your application identifier? Please contact support@findmine.com if you're missing or don't know your application identifier.
product_price
(number): The price of the product in USD, including any currently running sales.Example:
product_price: 29.99
product_in_stock
(boolean): Is the product in stock and available for purchase?true
if in stock and available for purchase.false
if out of stock or otherwise unavailable for purchase.Example:
product_in_stock: false
product_on_sale
(boolean): Is the product currently on sale?true
if an original price and discounted price are being shown,false
if the product is still at the original price.Example:
product_on_sale: true
Site-specific Required Parameters
During the integration kickoff, a unique identifier or set of unique identifiers will be chosen to identify distinct products. The passed in identifiers must match the feed exactly. The names and values of these parameters are specific to each integration.
Most commonly this looks like:
SAMPLE IDENTIFIER
product_id
(string): The top-level unique identifier for a productSAMPLE IDENTIFIER
product_color_id
(string): The color-specific sub-identifierExample:
{ product_id: "P123", product_color_id: "C2" }
The specific parameters necessary for your site will be discussed and agreed upon at the start of integration with Findmine
If you do not know the correct parameters, or if a complication is discovered during integration please contact support@findmine.com with any questions or concerns.
Sample Javascript Usage
var params = {
application: "AB1212CDABCD-SAMPLE-APP",
product_price: 12.99,
product_in_stock: true,
product_id: "P123"
}
findmine.match(params).then(function () {
findmine.render('#findmine-module')
})
Rendering Integration
The findmine module renders into the HTML element of your choice, and can either use Findmine-provided CSS or your own custom CSS integration.
Render Target
The findmine.render
function must be passed the ID of where to render. For example:
<div id="findmine-div" />
<script>
findmine.match({ /* params */}).then(function ()) {
findmine.render('#findmine-div')
});
</script>
You may place this div anywhere on the page.
CSS
If the CSS styling is being provided and maintained by Findmine, then link the URL that Findmine provides in the html head
element:
<link rel="stylesheet" type="text/css" href="https://www.findmine.com/static/css/YOUR_BRAND_NAME.css">
Otherwise you will need to provide your own styling information.
Full Sample
Putting it all together, a full Findmine integration looks something like this:
<head>
<link rel="stylesheet" type="text/css" href="https://www.findmine.com/static/css/sampleapp.css">
</head>
<body>
<div id="findmine-module" />
<script type="text/javascript" src="//www.findmine.com/findmine-latest.js"></script>
<script>
var params = {
application: "AB1212CDABCD-SAMPLE-APP",
product_price: 39.00,
product_in_stock: true,
product_id: "P123",
};
findmine.match(params).then(function (results) {
findmine.render('#findmine-module');
})
</script>
</body>