Is it possible to create an affiliate text link like this?

Sutra

Investor and Business Mentor
BuSo Pro
Joined
Oct 28, 2015
Messages
840
Likes
917
Degree
3
Not sure if this is possible but ay oh, oh ay.

My desktop users purchase things on Amazon via my affiliate links all day. My mobile users don't purchase shiiiet on Amazon via my affiliate links. However, my mobile users do convert well on affiliate links to a CPA offer.

I'd like to cater to both without increasing the number of affiliate links in an article (don't want to spam the articles with affiliate links).

Is it possible to place a text link and have it link to Amazon for desktop users, but when a mobile user clicks it it goes to the CPA offer?
 
I'd imagine you could use Javascript to change the link based on user-agent or you could use CSS Media queries to hide one or the other depending on the width of the viewport. Yes it's definitely possible. I'd think Javascript would be the "right" way to do it.
 
@Ryuzaki my theme has some shortcodes that allow viewing for certain devices only.

What do you think would cause LESS slowdown on a page load time, CSS media queries (I assume that's what the shortcodes end up doing, please correct me if I'm wrong) or Javascript? I typically place 3 affiliate links per article (up to 5 on longer articles).

Also, if I used Javascript, does that mean I place just one JS code on the site to accomplish what I want? Or would I have to insert a JS code for every affiliate text link I insert?
 
Use ad inserter to show link based on user device super easy!
 
How do you do that with AdInserter?

This is specifically for text links so the anchor text is always different.
 
you can add in text links in ad inserter - really easy dude, download and give it whirl it is free.
 
I have ad inserter. I use it for all my ads. Never heard about text links. Do you have a link to instructions? Think you might talking about a different plugin with similar name?
 
@Ryuzaki my theme has some shortcodes that allow viewing for certain devices only.

What do you think would cause LESS slowdown on a page load time, CSS media queries (I assume that's what the shortcodes end up doing, please correct me if I'm wrong) or Javascript? I typically place 3 affiliate links per article (up to 5 on longer articles).

Also, if I used Javascript, does that mean I place just one JS code on the site to accomplish what I want? Or would I have to insert a JS code for every affiliate text link I insert?

The speed impact could be equal.

For the CSS version you'll need to wrap the links in <span> and give it some kind of class such as <span class="cpa-swap">. You're adding a bit of HTML there. You might be able to add a class just to the <a> tag too. You'll also have to add some code to your CSS file for these classes in order to use the media queries.

For the JQuery version you'd have to load an additional .js file if you aren't already, and then bulk it out with code to identify and swap your link, (or if you do it more generalized you'll probably swap CSS classes and still have to add CSS code for the media queries in your .css sheet).

Either way, the text being added in the HTML / CSS / JS is negligible. But if the JS version requires you to load a .js file and you're not already loading one, then you're looking at another HTTP Request. At the end of the day it'll be small and worth the increased cash flow, I'm sure, if it converts like you suspect.

There's a lot of ways to skin a cat and I'm betting that someone else would know a better way to do this manually using jQuery and Javascript. It's not my specialty. I'm pretty sure the Javascript version would have to detect the width of the viewport after the page has loaded too, so it's going to be more of a dynamic change live on the screen versus something coming out of the initial CSS styling.

If I learn more, I'll let you know. This is something I'm looking at currently for display ads since Adsense seems to be the only guys who have gotten a grip on responsivity and don't want to charge an obscene premium for access to it. For me it becomes using jQuery to load ads after detecting viewport width. Otherwise you end up loading and subsequently hiding ads which is a no-no. In your case of text links it doesn't matter though.
 
Awesome, thanks for your wisdom good sir. Gives me some stuff to think about and start putting to use.
 
Back