Custom / HTML

Custom / HTML Integration

Easy · 1 minute setup

Universal HTML Integration

Works on any website — plain HTML, PHP, React, Vue, Angular, or any custom platform. Just add two lines of code.

1 Add the Widget Script

Add before </body>:

<script src="https://cdn.gunupdate.com/widget/gunupdate-widget.js"
        data-store="YOUR_API_KEY"
        defer></script>

2 Add the Widget Container

Place where you want the widget to appear:

<div id="gunupdate-widget"
     data-store="YOUR_API_KEY"
     data-product-id="YOUR_PRODUCT_ID"
     data-product-name="Product Name"
     data-product-sku="SKU-123"
     data-mode="compatibility"
     data-theme="light">
</div>

JavaScript API

Initialize programmatically for SPAs and dynamic pages:

// Initialize widget on demand
GunUpdate.init({
    store: 'YOUR_API_KEY',
    container: '#my-widget',
    mode: 'builder',
    theme: 'dark',
    product: {
        id: '12345',
        name: 'Magpul MOE Grip',
        sku: 'MAG415-BLK'
    },
    onResult: function(result) {
        console.log('Compatible:', result.compatible);
        console.log('Gun:', result.gun_model);
    }
});

// Destroy and cleanup
GunUpdate.destroy();

Events

document.addEventListener('gunupdate:result', function(e) {
    console.log(e.detail.gun);         // detected gun model
    console.log(e.detail.compatible);  // boolean
    console.log(e.detail.products);    // matching products array
});

document.addEventListener('gunupdate:scan', function(e) {
    console.log('Scan started', e.detail.scanId);
});

Widget Modes

compatibility

"Does this fit my gun?" — customer uploads photo or selects model, gets yes/no answer + compatible products from your store.

builder

Interactive gun builder — clickable hotspot zones on a gun silhouette. Customers explore accessory categories visually.

configurator

Full experience — build + compatibility check + smart recommendations. Best for stores with 50+ gun accessories.

Data Attributes Reference

Attribute Required Description
data-storeYesYour API key
data-product-idYesProduct ID on your platform
data-product-nameNoProduct name for better matching
data-product-skuNoSKU for precise matching
data-modeNocompatibility | builder | configurator
data-themeNolight | dark | auto
data-platformNoPlatform identifier for analytics
data-langNoLanguage code (default: en)

Requirements

  • • Any website with HTML access
  • • GunUpdate API key

Need an API key?

Free plan — 100 checks/month. No card required.

Get Free API Key

Need Help?

Our team can help with installation.

support@gunupdate.com