Gossamer Forum
Quote Reply
Hide affiliate links
Hello,

I would like to add some affiliate links to my site.
Most affiliate links tend to have a long URL which doesn’t look that good.

I’m looking for a way to "shorten" the URL displayed in link.html

Example:
http://affiliatesite.com/sites.php?id=re_ps_dave5_A_2_A&site=dsd&tmpl=11

To:
http://affiliatesite.com/sites.php?…

I think the best way is to setup a limit to the number of characters displayed. Like 20 characters after the "http://" . All characters after will be replaced by ”…”

Any others ideas would be appreciated.

Thank you,
Dave Smile

Quote Reply
Re: [Kool] Hide affiliate links In reply to
Hi,

The easiest way, would be to "split" it at the ?, so anything after that doesn't get shown. Here's how you could do it:

trim_url_down

Code:
sub {
my $url = $_[0];
my @tmp = split /\?/, $url;
return $tmp[0];
}

Then just call with <%trim_url_down($URL)%>

Hope that helps.

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Kool] Hide affiliate links In reply to
Hi Kool:

I actually would recommend you don't use the url at all, but instead jump.cgi. There is no value in showing the url, and if you are actually aiming at trying to earn some income from affiliate sales etc, research has shown that many people will either not click on the link OR they will modify it.

Regards,


Clint
--------------------------
http://AffiliatesDirectory.com
The Affiliate Programs Directory
Quote Reply
Re: [Clint] Hide affiliate links In reply to
Hi,

I think he's trying to just show a URL, rather that the full link :)

i.e:

Title
Description
http://www.domain.com

..or similar :)

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Andy] Hide affiliate links In reply to
Thank you very much for the help guys!



I’m aware that some people will not click on URL/affiliate link.

Removing the URL completely is an option, but I’m not sure if showing a partial domain would be better.



Andy, if I want to show only the domain, what would be the code (including the .com. .net etc)? replace"?" with "/"



Split at the "?" will not work for all affiliate links. Some don’t have it.

where do I place the code <%trim_url_down($URL)%>

Thanks,

dave



Last edited by:

Kool: Sep 12, 2007, 10:41 AM
Quote Reply
Re: [Kool] Hide affiliate links In reply to
Hi,

You would just do:

Code:
sub {
my $url = $_[0];
my @tmp = split /\//, $url;
return $tmp[2];
}

Also, that will split the http:// bit up (thus why I changed it to $tmp[2], instead of $tmp[0]). If you want to use the http:// bit in the front, you would just need to change:

Code:
return $tmp[2];

..to:

Code:
return qq|http://| . $tmp[2];

Hope that helps.

BTW, please try not to use bold in your whole post, it makes them a bit sore on the eyes :(

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Andy] Hide affiliate links In reply to
Thank you Andy! I'll try it.
Quote Reply
Re: [Kool] Hide affiliate links In reply to
Do you need to display the link URLs at all?
Quote Reply
Re: [Alba] Hide affiliate links In reply to
Alba, do you suggest not showing the URL?

My intention is to trim the URL after the .com
Quote Reply
Re: [Kool] Hide affiliate links In reply to
Quote:
do you suggest not showing the URL?

Just a thought, I removed the code from my templates.
Quote Reply
Re: Hide affiliate links In reply to
So how do we hide an affiliate link without making changes to its structure such as:
<*a href="http://click.affiliateexampleonly [] com/fs-bin/click?id=S15msfxNCM4&offerid=12345&subid=0"><*IMG alt="Savings by Affiliate" border="0" width="88" height="31" src="http://click.affiliateexampleonly [] com/fs-bin/show?id=S15msfxNCM4&bids=12345&gridnum=7&catid=-1&subid=0"*></a*>

... and how should the affiliate link look inside the code?
http://www.hopeforyou.com

Last edited by:

HopeForYou: Jun 4, 2009, 8:53 AM
Quote Reply
Re: [HopeForYou] Hide affiliate links In reply to
Erm, that looks like weird HTML (all kinda weird charachters, as well as * in it)

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Post deleted by HopeForYou In reply to

Last edited by:

HopeForYou: Jun 4, 2009, 9:28 AM
Quote Reply
Re: [HopeForYou] Hide affiliate links In reply to
Well, doesn't help us - as we don't know the proper format (i.e is the image just a small pixel, with a text link - or an actual image)

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Andy] Hide affiliate links In reply to
Andy wrote:
Well, doesn't help us - as we don't know the proper format (i.e is the image just a small pixel, with a text link - or an actual image)

Please standby for an e-mail.

Thanks!
http://www.hopeforyou.com

Quote Reply
Re: [HopeForYou] Hide affiliate links In reply to
Ok, so what you need to do - is add 2 new fields:

1) CleanURL CHAR(255) "Text" type field
2) ImageURL CHAR(255) "Text" type field

Then, when adding a link - you would enter the affiliate URL (i.e what they click on), in the "URL" field. Then, the CleanURL would be what you want to show them. Finally, if you have an image that needs showing - the image URL would be put in ImageURL.

The, in link.html - find stuff like:

Code:
<%URL%>

...and change to:

Code:
<%if CleanURL%><%CleanURL%><%else%><%URL%><%endif%>

Then, wherever you want the image to show - have:

Code:
<%if ImageURL%><img src="<%ImageURL" /><%endif%>

That simple.

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Andy] Hide affiliate links In reply to
BTW, this assumes you are using jump.cgi .

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Andy] Hide affiliate links In reply to
Andy wrote:
BTW, this assumes you are using jump.cgi .

Cheers

jump.cgi is being used at this time.

Thanks!
http://www.hopeforyou.com

Quote Reply
Re: [HopeForYou] Hide affiliate links In reply to
This seems to do the trick.

Thank you!
http://www.hopeforyou.com

Quote Reply
Re: [Andy] Hide affiliate links In reply to
Andy wrote:
Ok, so what you need to do - is add 2 new fields:

1) CleanURL CHAR(255) "Text" type field
2) ImageURL CHAR(255) "Text" type field

Then, when adding a link - you would enter the affiliate URL (i.e what they click on), in the "URL" field. Then, the CleanURL would be what you want to show them. Finally, if you have an image that needs showing - the image URL would be put in ImageURL.

The, in link.html - find stuff like:

Code:
<%URL%>


...and change to:

Code:
<%if CleanURL%><%CleanURL%><%else%><%URL%><%endif%>


Then, wherever you want the image to show - have:

Code:
<%if ImageURL%><img src="<%ImageURL" /><%endif%>


That simple.

Cheers

The ImageURL code was place into the home page and the image didn't showing up.

Any ideas?
http://www.hopeforyou.com

Quote Reply
Re: [HopeForYou] Hide affiliate links In reply to
How can we get the CleanURL and ImageURL to work in "include_rightsidebar.html"?
http://www.hopeforyou.com

Quote Reply
Re: [HopeForYou] Hide affiliate links In reply to
HopeForYou wrote:
How can we get the CleanURL and ImageURL to work in "include_rightsidebar.html"?

This is for LINKS not Categories!

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!