WPIntell

Source evidence

[NSFW] Add Support For Linkvertise Full Script API

Free Downloads WooCommerce · support · 2025-09-02T08:11:00+00:00

mixedsentiment
mediumseverity
0.68relevance
6replies
Evidence linked to opportunitycommercial context

Proof Health

Open evidence

Commercial opportunities need traceable source links before they are treated as build-worthy.

10 / 67 rows with source links

14.9% of this page's analysis has direct source links.

0 build-decision rows missing links

0 rows here require auditable proof before promotion.

57 rows with no attached evidence

0 rows have source counts but still need direct links.

Conversation

support
RedAISkye unresolved
It would be great if there’s an optional setting to integrate Linkvertise – Full Script API with the downloads. Since I primarily use it to share digital content for free, it would help when users would need to view Linkvertise Ad before the download begins. The page I need help with: [ log in to see the link] Hi. I am not familiar with this sorry. How does the API work – is it JavaScript? @wpenhanced Yes, it’s in javascript, works either with HTML script tag:- <script src="https://publisher.linkvertise.com/cdn/linkvertise.js"></script><script>linkvertise(<Your Linkvertise-ID>, {whitelist: ["<Only enter the domains you want to monetize>"], blacklist: []});</script> Or via wordpress plugin: https://wordpress.org/plugins/linkvertise-script-api It basically automatically converts links to Linkvertise ones, so user will be redirected to view Ad before redirected back to the actual download URL. Parameters can also be used instead of URLs, for WooCommerce download portal, whitelisting “download_file” would convert all download links that the user would generate with orders. This is the JS code:- linkvertise = function (user_id, options) { document.addEventListener('DOMContentLoaded', async function () { await convert(user_id, options); }, false); }; let convert = async function (user_id, options) { function str2ab(str) { const buf = new ArrayBuffer(str.length); const bufView = new Uint8Array(buf); for (let i = 0, strLen = str.length; i < strLen; i++) { bufView[i] = str.charCodeAt(i); } return buf; } const pemEncodedKey = -----BEGIN PUBLIC KEY-----<br> MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA1piHDY9WRIehbfC3Fpol<br> Ly/WrJF8TKFVdDMobj3fkNjN/69dTv9JgXt+gcJxVn/h4NCMtQ2mCQXNBMXzLOky<br> HJipiFMoyPtOOlMlbWRAiaQE1GpMebGNRcsxYnWzF53v63+hUQgrMahH9X0Ii/NJ<br> hvDyFlPX77+z9xiyd45L+xrgayePpOxvQpj6VJDlpNNKWbuIkFvkMmUVRM2TLulL<br> JSgs4EgoBZgTYRpmhgR8tYfDOW+cOctffggcMAzKUC2CzYNmhzX15O7DKaZdYgfa<br> BR/hqvyNAxBepHOJnBfHkQqaox5diHGqdwXXLwiJKzoK5R26vaI3jg2+d69VPSGL<br> 0QIDAQAB<br> -----END PUBLIC KEY----- ; const importKey = async function (pemEncodedKey) { const pemHeader = "-----BEGIN PUBLIC KEY-----"; const pemFooter = "-----END PUBLIC KEY-----"; const pemContents = pemEncodedKey.substring( pemHeader.length, pemEncodedKey.length - pemFooter.length - 1 ); const binaryDerString = window.atob(pemContents); const binaryDer = str2ab(binaryDerString); return await window.crypto.subtle.importKey( "spki", binaryDer, { name: "RSA-OAEP", hash: { name: "SHA-256" }, }, true, ["encrypt"] ); }; try { const elements = document.querySelectorAll("a[href]"); for (const link of elements) { const base_href = markup(link.href); if (!base_href.startsWith("http://") && !base_href.startsWith("https://")) { continue; } if (options.blacklist?.length > 0) { const filteredBlacklist = options.blacklist.filter((pattern) => pattern.trim() !== ""); const isBlacklisted = filteredBlacklist.some((pattern) => str_is(pattern, base_href)); if (isBlacklisted) { continue; } } if (options.whitelist?.length > 0) { const isWhitelisted = options.whitelist.some((pattern) => str_is(pattern, base_href)); if (!isWhitelisted) { continue; } } const encodedHref = (new TextEncoder()).encode(base_href); let part1, part2; if (encodedHref.length > 70) { part1 = encodedHref.slice(0, 70); part2 = (new TextDecoder()).decode(encodedHref.slice(70)); } else { part1 = encodedHref; part2 = ""; } const encryptedHref = await window.crypto.subtle.encrypt( { name: "RSA-OAEP", hash: { name: "SHA-256"}}, await importKey(pemEncodedKey), part1 ); let binary = ''; const bytes = new Uint8Array(encryptedHref); for (let i = 0; i < bytes.byteLength; i++) { binary += String.fromCharCode(bytes[i]); } let encryptedHrefBase64 = btoa(binary); const fullEncryptedHref = ${encryptedHrefBase64}${part2} ; const base_url = https://link-to.net/${user_id}/${Math.random() * 1000}/dynamic/ ; link.href = ${base_url}?r=${fullEncryptedHref}&v=2 ; link.target = "_blank"; } } catch (error) { console.error("Error during key import or link processing:", error); } }; const markup = (href) => { const link = document.createElement("a"); link.href = href; return link.href.endsWith("/") ? link.href.slice(0, -1) : link.href; }; const str_is = function (pattern, value) { if (pattern.indexOf("*") === -1) pattern = "*" + pattern + "*"; const regexPattern = pattern.replace(/\*/g, ".*"); const regex = new RegExp("^" + regexPattern + "$"); return regex.test(value); }; If it is javascript – cant you code it yourself to target the download buttons? @wpenhanced I have no idea how to do that. It requires URL for conversion so probably doesn’t work that way. Really sorry but this is outside our support scope. I can add it to our dev list but have to be honest and say it will be the low priority as never heard of this before so it seems very rare case that others will want it. We do offer custom dev work if you wanted to explore this you can contact us directly to see what we can do Thanks pete @wpenhanced Could you at least add option to have the hidden form parameters to instead be displayed in a Link? So the button/link opens a URL instead of passing a hidden form, similarly to how WooCommerce does it. That way, I would be able to whitelist the parameter “somdn_download_key”, so it automatically converts them all to Linkvertise URL.

Comments

6 shown
Wp Enhanced 2025-09-02T13:23:00+00:00

Hi. I am not familiar with this sorry. How does the API work – is it JavaScript?

RedAISkye 2025-09-02T17:39:00+00:00

@wpenhanced Yes, it’s in javascript, works either with HTML script tag:- <script src="https://publisher.linkvertise.com/cdn/linkvertise.js"></script><script>linkvertise(<Your Linkvertise-ID>, {whitelist: ["<Only enter the domains you want to monetize>"], blacklist: []});</script> Or via wordpress plugin: https://wordpress.org/plugins/linkvertise-script-api It basically automatically converts links to Linkvertise ones, so user will be redirected to view Ad before redirected back to the actual download URL. Parameters can also be used instead of URLs, for WooCommerce download portal, whitelisting “download_file” would convert all download links that the user would generate with orders. This is the JS code:- linkvertise = function (user_id, options) { document.addEventListener('DOMContentLoaded', async function () { await convert(user_id, options); }, false); }; let convert = async function (user_id, options) { function str2ab(str) { const buf = new ArrayBuffer(str.length); const bufView = new Uint8Array(buf); for (let i = 0, strLen = str.length; i < strLen; i++) { bufView[i] = str.charCodeAt(i); } return buf; } const pemEncodedKey = -----BEGIN PUBLIC KEY-----<br> MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA1piHDY9WRIehbfC3Fpol<br> Ly/WrJF8TKFVdDMobj3fkNjN/69dTv9JgXt+gcJxVn/h4NCMtQ2mCQXNBMXzLOky<br> HJipiFMoyPtOOlMlbWRAiaQE1GpMebGNRcsxYnWzF53v63+hUQgrMahH9X0Ii/NJ<br> hvDyFlPX77+z9xiyd45L+xrgayePpOxvQpj6VJDlpNNKWbuIkFvkMmUVRM2TLulL<br> JSgs4EgoBZgTYRpmhgR8tYfDOW+cOctffggcMAzKUC2CzYNmhzX15O7DKaZdYgfa<br> BR/hqvyNAxBepHOJnBfHkQqaox5diHGqdwXXLwiJKzoK5R26vaI3jg2+d69VPSGL<br> 0QIDAQAB<br> -----END PUBLIC KEY----- ; const importKey = async function (pemEncodedKey) { const pemHeader = "-----BEGIN PUBLIC KEY-----"; const pemFooter = "-----END PUBLIC KEY-----"; const pemContents = pemEncodedKey.substring( pemHeader.length, pemEncodedKey.length - pemFooter.length - 1 ); const binaryDerString = window.atob(pemContents); const binaryDer = str2ab(binaryDerString); return await window.crypto.subtle.importKey( "spki", binaryDer, { name: "RSA-OAEP", hash: { name: "SHA-256" }, }, true, ["encrypt"] ); }; try { const elements = document.querySelectorAll("a[href]"); for (const link of elements) { const base_href = markup(link.href); if (!base_href.startsWith("http://") && !base_href.startsWith("https://")) { continue; } if (options.blacklist?.length > 0) { const filteredBlacklist = options.blacklist.filter((pattern) => pattern.trim() !== ""); const isBlacklisted = filteredBlacklist.some((pattern) => str_is(pattern, base_href)); if (isBlacklisted) { continue; } } if (options.whitelist?.length > 0) { const isWhitelisted = options.whitelist.some((pattern) => str_is(pattern, base_href)); if (!isWhitelisted) { continue; } } const encodedHref = (new TextEncoder()).encode(base_href); let part1, part2; if (encodedHref.length > 70) { part1 = encodedHref.slice(0, 70); part2 = (new TextDecoder()).decode(encodedHref.slice(70)); } else { part1 = encodedHref; part2 = ""; } const e...

Wp Enhanced 2025-09-04T08:15:00+00:00

If it is javascript – cant you code it yourself to target the download buttons?

RedAISkye 2025-09-04T08:35:00+00:00

@wpenhanced I have no idea how to do that. It requires URL for conversion so probably doesn’t work that way.

Wp Enhanced 2025-09-09T08:34:00+00:00

Really sorry but this is outside our support scope. I can add it to our dev list but have to be honest and say it will be the low priority as never heard of this before so it seems very rare case that others will want it. We do offer custom dev work if you wanted to explore this you can contact us directly to see what we can do Thanks pete

RedAISkye 2025-09-10T08:26:00+00:00

@wpenhanced Could you at least add option to have the hidden form parameters to instead be displayed in a Link? So the button/link opens a URL instead of passing a hidden form, similarly to how WooCommerce does it. That way, I would be able to whitelist the parameter “somdn_download_key”, so it automatically converts them all to Linkvertise URL.