Skip to content

Open source lib for Merchants to detect if a shopper is using a shady coupon extension like Honey, Klarna, Capital One Shopping or Rakuten.

License

Notifications You must be signed in to change notification settings

cpreid/coupon-shield

Repository files navigation

Coupon Shield 🛡️

Tool for eComm merchants to detect, warn and prevent a customer from shopping using a shady coupon browser extension.

image

Easy install (no-JS)

This will automatically detect a coupon extension and show a default warning to the user to disable the extension as shown above). Install this at the very top of the <head> in your webpage to ensure it runs prior to the extension. jsDelivr package page.

<script src="https://cdn.jsdelivr.net/npm/coupon-shield@latest/dist/auto.min.js"></script>

Custom Usage (Browser Global)

<script src="https://cdn.jsdelivr.net/npm/coupon-shield@latest/dist/couponshield.min.js"></script>
<script>
window.couponShield.listen((warn, vendor) => {
    // Decide how you want to handle this. Native warn function allows you to tell the user to disable the extension.
    // vendor is "honey", "Capital One Shopping", "Rakuten", or "Klarna"
    warn("You must disable the Honey extension to continue.");
  });
</script>

Custom Usage (ESM)

npm install coupon-shield
import { listen } from "coupon-shield";

listen((warn, vendor) => {
  // Decide how you want to handle this. Native warn function allows you to tell the user to disable the extension.
  // vendor is "honey", "Capital One Shopping", "Rakuten", or "Klarna"
  warn("You must disable the Honey extension to continue.");
});

Advanced Options

window.couponShield.listen((warn, vendor, el) => {
  // removePageElement defaults to true (extension element loaded onto the page is auto-removed).
  // Set removePageElement to false if you want to keep the extension element for some reason.
  // el is only defined when removePageElement is false.
  // vendor is "honey", "Capital One Shopping", "Rakuten", or "Klarna"
}, { removePageElement: false });
window.couponShield.listen((warn, vendor) => {
  // Stop observing if nothing is detected within 10 seconds.
}, { unbindAfterSeconds: 10 });

About

Open source lib for Merchants to detect if a shopper is using a shady coupon extension like Honey, Klarna, Capital One Shopping or Rakuten.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published