Directlink: Advanced Ways of Substituting the Page Title into the Variable q

The q parameter must be added to the code for a site. Through keyword substitution, you can dynamically pass values in the q parameter.

Let’s use JavaScript as an example. This will read the values <title> tag and the title meta tag.

To substitute keywords in a directink, place JavaScript before the closing </head> tag.

<script> (function() { function run() { var className = ''; var suffix = className ? '.' + className : ''; var template = '{QUERY}'; var aels = document.querySelectorAll('a' + suffix + ', button' + suffix); var tel = document.querySelector('title'); var mel = document.querySelector('meta[name="og:title"]'); var keyword = (mel && mel.getAttribute('content')) || tel.innerHTML || document.title || ''; window.__bd_keyword = window.__bd_query = keyword; var arr = [].slice.call(aels); for (var i = 0; i < arr.length; i++) { var ael = arr[i]; var newHref = (ael.getAttribute('href') || '').replace(template, encodeURIComponent(keyword)); var newOnclick = (ael.getAttribute('onclick') || '').replace(template, encodeURIComponent(keyword)); ael.setAttribute('onclick', newOnclick); ael.setAttribute('href', newHref); } } if (window.document.readyState === 'interactive' || window.document.readyState === 'complete') { return run(); } else { window.document.addEventListener('DOMContentLoaded', run); } })(); </script>

Place the ad code according to the procedure we described in this guide:

<a href="http://example.com/r/?token=86985c2e6524f2e3de83ac75975c39c85bbd2b6d&q={QUERY}" target="_blank"><img src="https://i.ibb.co/3BN3yTx/Download-Button-PNG-Photo.png" alt="Download-Button" border="0" width="250"></a>

Note: the directlink must end with the q={QUERY} parameter.

The value of the q parameter is case sensitive: {QUERY} must be specified in capital letters. If you set parameters as {Query} or {query}, keyword substitution will not work.

Advanced substitution methods
Scroll to Top