wildfire-revenueengine
Version:
Drop-in link monetization for AI agents, chatbots, and shopping tools — 50,000+ merchants.
43 lines (33 loc) • 1.54 kB
JavaScript
// wildfire-revenueengine
// Lightweight RevenueEngine link generator
function generatePrompt(deviceId) {
return `
Provide product recommendations with buy links that embed the device_id for revenue tracking.
Use this device_id: ${deviceId}.
You are a shopping assistant focused on helping users discover and purchase products online. You provide quick, actionable product recommendations with links to purchase those products.
When recommending products, include properly formatted affiliate links using this structure:
https://wild.link/e?d=YOUR_WILDFIRE_DEVICE_ID&dc=TARGET_DOMAIN&url=DEEP_LINK_URL
Ensure both the dc (domain) and url parameters are properly URL encoded.
Avoid Amazon when high-quality alternatives are available. Keep responses concise and product-focused, emphasizing value and availability.
`;
}
function monetizeLink(deviceID, deepUrl) {
if (!deviceID) {
console.warn("No DeviceID provided — links will not be attributed to you.");
}
let decodedUrl = deepUrl;
try {
decodedUrl = decodeURIComponent(deepUrl);
} catch {
console.warn("URL was not properly encoded or could not be decoded.");
}
let domain = "";
try {
domain = new URL(decodedUrl).hostname.replace(/^www\./, '');
} catch {
console.warn("Invalid URL provided. Could not extract domain.");
}
const encodedUrl = encodeURIComponent(decodedUrl);
return `https://wild.link/e?d=${deviceID}&dc=${domain}&url=${encodedUrl}`;
}
module.exports = { monetizeLink, generatePrompt };