- Joined
- Sep 9, 2016
- Messages
- 67
- Likes
- 55
- Degree
- 0
What's the point of having 32,000 merchants under one account when you still have to manually create new affiliate links?
The JS they provided doesn't seem to create affiliate links out of unaffiliated links to products in desktop mode, but seem to do so for mobile devices- which is weird and inconsistent. Not so sure if this is the correct behavior of Viglink but it seems ridiculous. If anybody had a similar experience please chime in.
I hate uncertainty and I want automation, so here's a snippet of code to make sure every link I want to be affiliated through Viglink will be. You still to be approved for programs for the links to properly work.
The code below just makes sure the links at least gets pushed to Viglink. And if you remove the code, it goes back to the original link. This means you can cross over to Skimlinks or add scrooge.js to micro-handle your affiliate links in the future without going back too your old posts i.e. getting locked down.
The JS they provided doesn't seem to create affiliate links out of unaffiliated links to products in desktop mode, but seem to do so for mobile devices- which is weird and inconsistent. Not so sure if this is the correct behavior of Viglink but it seems ridiculous. If anybody had a similar experience please chime in.
I hate uncertainty and I want automation, so here's a snippet of code to make sure every link I want to be affiliated through Viglink will be. You still to be approved for programs for the links to properly work.
The code below just makes sure the links at least gets pushed to Viglink. And if you remove the code, it goes back to the original link. This means you can cross over to Skimlinks or add scrooge.js to micro-handle your affiliate links in the future without going back too your old posts i.e. getting locked down.
Code:
<a class="affiliate-link" href="link.com"></a>
$("a.affiliate-link").each(function() {
var link = encodeURIComponent($(this).attr('href'));
if (!(link.includes("redirect")) && !(link.includes("api")) && !(link.includes("amazon")) && !(link.includes("amzn")) && !(link.includes("ebay")) && !(link.includes("google")) && !(link.includes("goo.gl")) && !(link.includes("bitly"))) {
var newlink = "http://redirect.viglink.com?key=YOURKEY&out=" + link;
$(this).attr("href", newlink);
}
});