Example Integration

This page shows the exact HTML you need on your site: the loader tag and a download link. The loader here ships without a public key on purpose — add your own when you integrate.

1) Include the loader

Place this near the end of your <body> on pages that host download links.

<script src="/plugin.js"
  data-key=""         
  data-api="https://ashtonx24-inkdna.hf.space"
  data-observe='a[href*=".pdf"],a[data-inkdna]'
  data-mode="loose"
  async></script>
Note: leaving data-key empty keeps this example inert. On your site, paste your public key prefix (not the full secret).

2) Your download link

Tip: use data-inkdna-order or ?order= so your download carries a verifiable Order ID.

Use a normal anchor. Add data-inkdna and (optionally) an order ID.

<a href="/assets/sample.pdf"
   data-inkdna
   data-inkdna-order="ORDER-123">Download your PDF</a>

That’s it. When a visitor clicks, the loader requests a fingerprinted copy for this asset (and carries your order ID if provided).

Download (attribute) Download (?order=…) Docs: dynamic Order ID

How to pass an Order ID (pick ONE)

1) Explicit attribute (works anywhere)

Add data-inkdna-order to the link:

<a href="/assets/sample.pdf"
   data-inkdna
   data-inkdna-order="ORDER-123">Download</a>

2) URL parameter (no HTML changes)

Append a query param your platform already knows (the loader understands these):

/assets/sample.pdf?order=ORDER-123

Accepted keys: order, order_id, order-received, oid

3) Page hint (auto-share one order to all links)

Run this tiny script on your “thank you / order complete” page—no HTML edits:

<script>(function(){
  var el = document.querySelector('#orderNo, .order-number, [data-order-number]');
  var ord = el ? (el.textContent || el.value || '').trim() : '';
  if (!ord) { var q = new URLSearchParams(location.search);
    ord = q.get('order') || q.get('order_id') || q.get('order-received') || q.get('oid') || ''; }
  if (ord) { document.body.dataset.inkdnaOrder = ord;
    document.querySelectorAll('a[href$=".pdf"],a[data-inkdna]').forEach(function(a){
      a.dataset.inkdnaOrder = ord;
    });
  }
})();</script>
WooCommerce: on the thank-you page, Woo exposes an order-received param. This one-liner is enough:
<script>(function(){
  var q=new URLSearchParams(location.search);
  var ord=q.get('order-received')||q.get('order')||'';
  if(ord) document.body.dataset.inkdnaOrder=ord;
})();</script>

Optional: auto-detect Order ID from the page

If your platform exposes the order on thank-you pages, this helper shares it with all links:

<script>(function(){
  var el = document.querySelector('#orderNo, .order-number, [data-order-number]');
  var ord = el ? (el.textContent || el.value || '').trim() : '';
  if (!ord) { var q = new URLSearchParams(location.search);
    ord = q.get('order') || q.get('order_id') || q.get('order-received') || q.get('oid') || ''; }
  if (ord) { document.body.dataset.inkdnaOrder = ord;
    document.querySelectorAll('a[href$=".pdf"],a[data-inkdna]').forEach(function(a){
      a.dataset.inkdnaOrder = ord;
    });
  }
})();</script>