UBBCentral
Posted By: jgeoff Embedding Amazon Affiliate Code - 01/23/2007 11:26 PM

I think it'd be nifty if Threads could automatically embed site owners' affiliate codes into appropriate links when posted by members.

For example, if someone links to this product on Amazon.com:
http://www.amazon.com/AJAX-PHP-Buil.../104-6772149-0161532?ie=UTF8&s=books

I'd like to have my affiliate code appended to the end of that link.

One or either of these should work:
/myaffiliatecode
or
&tag=myaffiliatecode

It'd have to be tested to see which works better.

Again, this code would be added if any member were to post a "check this item out" link

One complication would be to recognize/designate different affiliate codes for amazon.com, amazon.co.uk, amazon.de, amazon.ca, etc, etc. wink


Posted By: Gizmo Re: Embedding Amazon Affiliate Code - 01/24/2007 2:22 AM
jgeoff, teach me how they craft their url's, and how you sign up, and I'll make you a custom bbcode.
Posted By: Fishtails Re: Embedding Amazon Affiliate Code - 01/24/2007 4:23 PM
This is a great idea, but it would be even greater if other affiliate code could be added as well, such as ebay, bass pro, etc.
Posted By: jgeoff Re: Embedding Amazon Affiliate Code - 01/24/2007 7:23 PM

Yeah, I was thinking ebay as well, but that code is infinitely more complex, being loaded into an iframe from Commission Junction. It may be possible, though, by using the end links' format. Would need to be tested - but I think Step 1 should be Amazon.
Posted By: Gizmo Re: Embedding Amazon Affiliate Code - 01/24/2007 8:12 PM
lol let me know what services and how to craft urls and i'll work on something.

as or commission junction; i hate them, hate hate hate...
Posted By: jgeoff Re: Embedding Amazon Affiliate Code - 01/24/2007 9:09 PM

Giz - Amazon *should* work if you can 1) recognize that it's an amazon.com link, and 2) just appened one of those endings to the link.

One or both of those endings could work, it'd have to be tested.

This wouldn't be like a formatting button because it'd have to recognize the URL pasted into a post by anyone - not someone purposely helping me to add my affiliate code to it. wink That's why it's probably a bit harder than it seems...



Posted By: jgeoff Re: Embedding Amazon Affiliate Code - 01/24/2007 9:13 PM

Of course life would be easier with an "Amazon button" where you'd just paste the item # - but no one's gonna go thru that extra step probably, and probably not accurately if they did...
Posted By: Gizmo Re: Embedding Amazon Affiliate Code - 01/25/2007 3:42 AM
a ubbcode would be easiest, a replace would work too; any idea where i go to sign up?
Posted By: jgeoff Re: Embedding Amazon Affiliate Code - 01/25/2007 7:21 AM

Originally Posted by Gizmo
any idea where i go to sign up?


It was pretty hard to find wink

http://affiliate-program.amazon.com/gp/associates/join

Posted By: Gizmo Re: Embedding Amazon Affiliate Code - 01/25/2007 7:38 AM
lol hush or i won't figure something out wink
Posted By: jgeoff Re: Embedding Amazon Affiliate Code - 01/25/2007 7:42 AM

Someone must've hacked into my account to post something so rude whistle wink
Posted By: Gizmo Re: Embedding Amazon Affiliate Code - 01/25/2007 7:50 AM
:yawn: done... Well, assuming what you told me is correct about just adding /affiliateid/ to the amazon url...

In /libs/ubbthreads.inc.php
Find:
Code
		$body = preg_replace( "#(\r\n|\r|\n)#i", "", $body );


Add Under:
Code
		$body = str_replace("http://www.amazon.com/", "http://www.amazon.com/ugse-20/", $body);


Will turn any mention of:
http://www.amazon.com/

Into:
http://www.amazon.com/youraffiliatekey/
Posted By: Gizmo Re: Embedding Amazon Affiliate Code - 01/25/2007 7:53 AM
odd, it seems just adding the /affiliatekey doesn't work... i get a 404 at amazon...
Posted By: jgeoff Re: Embedding Amazon Affiliate Code - 01/25/2007 7:57 AM

That's a good tip, tho - thanks. cool I'll play with it tomorrow now that I know where to begin. Kinda tired right now, and gotta hit the sack soon... :/

Posted By: Gizmo Re: Embedding Amazon Affiliate Code - 01/25/2007 8:05 AM
yeh, craft a url to something that works and let me see it (and please bold your id) and i'll figure something out... I'm sure there is another unique string that i can screw around with hehe...
Posted By: Ian Re: Embedding Amazon Affiliate Code - 01/25/2007 9:36 AM
These are typical links...

http://www.amazon.co.uk/exec/obidos/ASIN/1862230625/ecruise

http://www.amazon.co.uk/gp/product/...reative=6738&creativeASIN=B000EXZAOY

The original page for the second item is....

http://www.amazon.co.uk/gp/product/B000EXZAOY/ref=amb_link_38725765_/203-9315599-5511968

However if it is a case of just tagging amazon.co.uk or .com then

http://www.amazon.co.uk/exec/obidos/redirect-home?site=amazon&tag=ecruise for the uk site or
http://www.amazon.com/exec/obidos/redirect-home?site=amazon&tag=ecruise for the USA one.
Posted By: Gizmo Re: Embedding Amazon Affiliate Code - 01/25/2007 8:14 PM
So one type of URL is:
http://www.amazon.co.uk/gp/product/B000EXZAOY?
ie=UTF8
&tag=ecruise
&linkCode=as2
&camp=1634
&creative=6738
&creativeASIN=B000EXZAOY

Another is:
http://www.amazon.com/SanDisk-SDSDG...9755952/ref=sr_1_21/002-5650966-1080038?
ie=UTF8
&s=photo

Will play again tonight...
Posted By: jgeoff Re: Embedding Amazon Affiliate Code - 01/25/2007 9:28 PM

Okay, I may have it... but won't know for sure until I get stats back.

METHOD

In Amazon's affiliate area, you can create links to any product by using their redirect link.

So a link to this:
http://www.amazon.com/Family-Guy-Vol-Season-Part/dp/B000HT3P6U/ref=wl_gtwy_ty/104-6772149-0161532?%5Fencoding=UTF8&coliid=I4S9D64SV0IS8&colid=GWCWI0CVIG8D

Would become this:
http://www.amazon.com/gp/redirect.html?ie=UTF8&location=http%3A%2F%2Fwww.amazon.com%2FFamily-Guy-Vol-Season-Part%2Fdp%2FB000HT3P6U%3F%255Fencoding%3DUTF8%26coliid%3DI4S9D64SV0IS8%26colid%3DGWCWI0CVIG8D&tag=AFFILIATECODE&linkCode=ur2&camp=1789&creative=9325

So replacing
http://www.amazon.com/
with
http://www.amazon.com/gp/redirect.html?ie=UTF8&location=http://www.amazon.com/
will redirect links

So what I did was the above, while also adding &tag=AFFILIATECODE before the &location=

In ubbthreads.inc.php
On or around Line 933, find:
Code
$body = preg_replace( "#(\r\n|\r|\n)#i", "<br />", $body );

And afterwards place:
Code
$body = str_replace("http://www.amazon.com/", "http://www.amazon.com/gp/redirect.html?ie=UTF8&tag=AFFILIATECODE&location=http://www.amazon.com/", $body);


Replace AFFILIATECODE with your Amazon.com affiliate code.

RESULT

When using that redirect, the landing page becomes:
http://www.amazon.com/Family-Guy-Vo...32?_encoding=UTF8&tag2=AFFILIATECODE

First off, the link works, so no harm/no foul. I will have to see if it actually counts because it does one thing: It changes &tag=AFFILIATECODE to &tag2=AFFILIATECODE

Amazon has usually been pretty good retrieving the AFFILIATECODE from the URLs, so let's hope this works despite the difference in tag name.

If that indeed works, I'll check for compatibility with Amazon.co.uk and Amazon.ca, etc, and create a tutorial here and at ubbdev.com

(Thanks to Gizmo for introducing me to str_replace wink )
Posted By: Gizmo Re: Embedding Amazon Affiliate Code - 01/25/2007 9:35 PM
Let me now how it works; and not a problem wink... So many replace options, it can be a pain to choose the right one lol... I've used strreplace for similar things so I knew how to use it to do this hehe...

oh and btw, i WAS just going to add a replace for one of the terms and embed the affiliate id, but it could also effect other urls; so your method, if it works properly, would work better i think
Posted By: Gizmo Re: Embedding Amazon Affiliate Code - 03/28/2007 8:04 AM
jgeoff, just a friendly bump to see how things are going! smile
Posted By: Gizmo Re: Embedding Amazon Affiliate Code - 03/28/2007 8:09 AM
Also, I had a queston for you actually, since you've been doing this for a while I figure you're the best resource...

Say I have the Affiliate ID "ugse-20", and I want to link to this product... I'd do it like this yes?:
http://www.amazon.com/gp/redirect.html?ie=UTF8&tag=ugse-20&location=http://www.amazon.com/Nintendo-DS-Lite-Onyx-Black/dp/B000I10PY2/

I ask because when I do that, I'm redirected to a url which no longer has my affilaiteid?
Posted By: JPFolks Re: Embedding Amazon Affiliate Code - 03/29/2007 12:15 PM
Hi Guys,

First, you're all geniuses. I never even THOUGHT of something like this but wow.. it could really help a lot of volunteer org's like us. So has the problem been solved and if so, how can us mere mortals use it? Also, can anyone here educate me on Google ads and how to best incorporate them into a the UBB? We have no current advertising on our site, but we get about 16K visitors a day and about 100,000 page views a day on our UBB and it seems like we could make some money to help our Org based on that much traffic couldn't we? Any suggestions from you guys on the best thing we could do to raise some money for the group with that type of traffic? Is it enough to generate anything?

Brian
Posted By: Ian Re: Embedding Amazon Affiliate Code - 03/29/2007 12:39 PM
Google ads are very simple to add. For example this is a custom island on my forums

Code
$time = time();

/* BODY HERE */
$body = <<<EOF

<center>

<script type="text/javascript"><!--
google_ad_client = "pub-4711273843698100";
google_ad_width = 150;
google_ad_height = 600;
google_ad_format = "120x600_as";
google_ad_type = "text";
google_ad_channel = "7536651497";
google_color_border = "f9f9f9";
google_color_bg = "F9F9F9";
google_color_link = "135060";
google_color_text = "333333";
google_color_url = "135060";
//--></script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>

</center>

EOF;


This will show four google ads wherever you choose to display the custom box. Simply name the box - 'sponsors links' or similar - you cannot use words such as 'please click these links to support our site'.

Posted By: Gizmo Re: Embedding Amazon Affiliate Code - 03/29/2007 10:16 PM
Please keep in mind that Google's maximum is 3 seperate ad islands (FAQ entry available here).

JPF, if you want a good structure of google ads, check out my forum (UGN), all areas are determined va ad placement and ad blending guidelines from google's faq.
Posted By: JPFolks Re: Embedding Amazon Affiliate Code - 04/05/2007 7:31 AM
Hey Gizmo,

So what is the reality potential for earnings with Google ads? We get about 16K visitors a day to our boards.. about 100,000 page views a day. Do you get anything for views, or is it only if someone clicks? And what would stop us from sending out our newsletter and asking folks to visit our boards and click the links to help support the org? I.e. don't they WANT people to click the links? And do they only count unique IPs? If so, what happens with something like AOL which uses one big IP for huge numbers of visitors a day?

Thanks for any info you can offer.

Brian
Posted By: Gizmo Re: Embedding Amazon Affiliate Code - 04/05/2007 9:03 AM
It all depends on placement, blending techniques, and targeted ads... not to mention that users must want to click on the ads...

One of my clients pulls $150 per day, myself i pull like $3/day, and another client pulls $6 a day... so it can really vary quite a bit...

You do get some for views, but it's quite miniscule...

You cannot publicly state that you want people to click on ads, it's against the AUP with google; you can however word it such as "Support our Site" and "Visit a Supporter" or "Our Sponsors", etc.

They count how many ips click links so your users can't go overboard; they do NOT want fake clickthroughs...

They give some leniancy to proxies, such as AOHell...

If you sign up, you can use me as a referral wink... gizmo@undergroundnews.com
© 2019 UBB.threads PHP Forum Software Community