Automatically append ID to at the end of specific URLs

This is very simple to achieve with JavaScript. Place this at the bottom of your page, just before </body> tag.

This will append ?pp=my-affiliate-id at the end of your links. Just change the variable aid value below:

<script>
// Change "my-affiliate-id" below to your actual affiliate id
const aid = 'my-affiliate-id';

// Append slash with affiliate id, only if an affiliate ID is not found in the link yet
const goglinks = document.querySelectorAll('a[href*="gog.com"]');
goglinks.forEach(function(el) {
  if(!el.href.includes('pp=')) {
    el.href = el.href.replace(/\?.*$/, '') + '?pp=' + aid
  }
})
</script>

Demo: https://jsfiddle.net/samliew/ks3y8059