Log in

View Full Version : Amazon Associates Hack for VB3


amykhar
12-05-2004, 10:00 PM
This hack converts any US amazon link posted on your board to use your affilliate id and is based of some work Logician did for me in Vbulletin 2, but is an improved rewrite. The old version did not track well with Amazon because it did not strip out Amazon session ids.

Please note that you need to change my affilliate id to use yours.

Also note that the chunk of code you are looking for in edit.php may not be an exact match in your file. You are looking for the query that updates the post table with the edited post.

Regarding Update.zip Update.zip contains a new functions_amazon.php that I would like some people to try out before I add to the regular zip file. The new function handles Amazon's new link format, and I believe, works better than the original function. Please LET ME KNOW if you try it and it works for you.

-------------
This hack will always be free, however your donations are kindly accepted and will help towards further development. If you donate, please leave me some info (either your forum site or username at vB.org) so that I can thank you. :)
https://vborg.vbsupport.ru/external/2010/02/12.gif (https://www.paypal.com/xclick/business=amykhar%40yahoo.com&item_name=UserPage+Donation&no_shipping=1&cn=Your+Comments&tax=0&currency_code=USD)

MrNase
12-06-2004, 12:44 PM
What does this hack do?

amykhar
12-06-2004, 12:45 PM
What does this hack do?
converts any amazon link posted on your board to user your affilliate id.

Blue Moose Aaron
12-06-2004, 01:03 PM
This is a really good idea. I will install for sure when complete!

Reeve of shinra
12-06-2004, 01:21 PM
I'm really glad to see this released. How does this work with your non-us members?

amykhar
12-06-2004, 02:13 PM
I'm really glad to see this released. How does this work with your non-us members?
I don't really have many members who use non-us amazon sites. So, I haven't tested that aspect. I believe some work would be required to make it more international.

amykhar
12-07-2004, 02:38 AM
For the record, I installed this hack 3 days ago and have already sold 22 items. Given that I have an off-topic site that normally sells 2 or so items a quarter without the hack, I think this has the potential to make serious money for forums with a true focus.

Amy

fiber1
12-07-2004, 09:33 AM
Nice, I just put a full amazon shop on my site instead though since it only took about 5 minutes.

dndog
12-08-2004, 03:23 AM
AWESOME.

This is sheer genius.

/me clicks install.

NightWalk8r
12-08-2004, 03:47 AM
Thanks you soooo much!!!!!!!

Phalynx
12-09-2004, 09:37 PM
Good tool, thanks.

amykhar
12-10-2004, 12:34 PM
Is anybody actively using it? Found any link rendering problems? I know that it's tracking items very well and I am getting credit for purchases - even direct links to products. My one concern is that with people using different editors (WYSIWYG, enhanced, and guided, etc.) that some of the urls might get botched.

If no problems have been reported in a couple of weeks, I'll move on to getting this working in the PM system as well.

Amy

amykhar
12-11-2004, 09:38 PM
This hack is now out of beta. Enjoy.

bold
12-11-2004, 10:29 PM
This hack is now out of beta. Enjoy.
Thanks for the hack. Do i replace epinionaddicts?

amykhar
12-11-2004, 10:42 PM
Thanks for the hack. Do i replace epinionaddicts?
Yes, you do.

boatdesign
12-14-2004, 01:12 AM
Awesome modification - thank you very much!!!

Only problem is that for some reason it is working fine for me if I use the Enhanced editor, but if I use the Standard editor it is not working at all it seems. I cannot figure out how to get it to work with the standard editor...

amykhar
12-14-2004, 01:33 AM
Awesome modification - thank you very much!!!

Only problem is that for some reason it is working fine for me if I use the Enhanced editor, but if I use the Standard editor it is not working at all it seems. I cannot figure out how to get it to work with the standard editor...
Let me check the code when I get home. I may have tweaked something else that I forgot to put in the instructions.

amykhar
12-14-2004, 12:01 PM
Let me check the code when I get home. I may have tweaked something else that I forgot to put in the instructions.
Try this:

In the file includes/functions_newpost.php Find:

$urlReplaceArray = array(
"http://\\2\\4"
);


Replace with:


$urlReplaceArray = array(
"\\2\\4 (\"\\2\\4\")"
);


For some reason, vbulletin developers decided to put urls in the database differently depending on the editor used. This just makes the standard editor urls the same format as the WYSIWYG.

I'll add this to the text file.

Amy

rinkrat
12-15-2004, 06:58 AM
Great idea!! I love this!!

boatdesign
12-16-2004, 02:48 AM
Fantastic!!! Thanks very very much Amy :)

(and I'm sorry I didn't say thank you earlier - because of the way vbulletin doesn't leave the url statements in the code, they looked exactly the same to me when I first saw the reply, but if you hit quote you can see the difference.

Thanks again so much - works great!

amykhar
12-19-2004, 11:06 PM
I have updated the code so it now works in private messages as well. In addition, I tweaked things so you only have to change the affilliate id in one place, and have made the code a bit easier to install.

If you have the old version installed, you will need to remove the changes you made in functions_newpost.php and editpost.php.

limey
01-05-2005, 06:37 PM
getting double //ref=nosim with latest code. Not that it matters really I think it still tracks ok.

Great hack!

RichieBoy67
01-05-2005, 10:04 PM
I am sure this will sound stupid...

I am trying to edit the functions_amazon.php file and I am very confused as to where my associates ID goes.... It asks for it in a few places... I don't want to mess up...

help please..

amykhar
01-05-2005, 10:56 PM
I am sure this will sound stupid...

I am trying to edit the functions_amazon.php file and I am very confused as to where my associates ID goes.... It asks for it in a few places... I don't want to mess up...

help please..
// enter your associate id here

$associate_id = "your_id";


You only need to change it in one spot. The rest use the variable. Change it right where it says your_id.

amykhar
01-05-2005, 10:57 PM
getting double //ref=nosim with latest code. Not that it matters really I think it still tracks ok.

Great hack!
Yes, it still tracks :)

RichieBoy67
01-05-2005, 11:02 PM
Cool, That is exactly what I did but I wanted to be sure....

Thanks :)

amykhar
01-05-2005, 11:07 PM
Don't hold me to this one, gang, cause I haven't tested it. But I THINK you can make this work for international Amazon sites simply by changing the .com to the extension you desire whereever it occurs in the Amazon functions file. (Please don't try to do this if you can't code. Wait until somebody with experience tests it first)

For example, if you use the Canadian Amazon, you would change .com to .ca everywhere it occurs.

If you use more than one Amazon because you are a multicultural site, you would just have to repleat the code blocks - once for each country. AGAIN DON'T TRY THIS IF YOU AREN'T A CODER. LET SOMEBODY ELSE PAVE THE WAY.

I'm not going to support the internationalization aspect because I don't use it. Try it at your own risk.

Slave
01-08-2005, 10:48 AM
Just looking at this .. and a question comes to mind ..

What's the point/need for the "/ref=nosim/"?

(This is for co.uk Amazon btw .. not .com)

limey
01-08-2005, 12:28 PM
Just looking at this .. and a question comes to mind ..

What's the point/need for the "/ref=nosim/"?

(This is for co.uk Amazon btw .. not .com)

ref=nosim means that when you goto amazon's product/item page there are NO similar items on that page. Just the item in question.

Cheers.

cteselle
01-26-2005, 05:10 PM
Thanks for putting this together!

It's great that it deletes other associate id's from the direct links, however if someone links to the main page using:

http://www.amazon.com/exec/obidos/redirect-home/someid-20

the link turns into:

http://www.amazon.com/exec/obidos/redirect-home/someid-20/ref=nosim/myid-20

Who gets the credit then?

amykhar
01-26-2005, 05:28 PM
I don't know. But, if I get time in the next day or so, I'll work on knocking other people's referrals out of other links as well.

Amy

OrangeFlea
02-04-2005, 03:00 PM
I recently visited a message board that had a "Shop with Amazon" drop down menu on the top of their forum (navigation bar area). When users click on this link, a small search box (similar to the “Search Forum” box) with an amazon logo and design appears, in where users would enter their query in the search-like box. For example, a member would type in a product name and it would automatically take them to the corresponding amazon.com page.

I was wondering how I would be able to install this feature onto my message board. Please try to be very thorough and detailed when describing the steps and the coding involved.

cteselle
02-04-2005, 03:51 PM
I recently visited a message board that had a "Shop with Amazon" drop down menu on the top of their forum (navigation bar area). When users click on this link, a small search box (similar to the ?Search Forum? box) with an amazon logo and design appears, in where users would enter their query in the search-like box. For example, a member would type in a product name and it would automatically take them to the corresponding amazon.com page.

I was wondering how I would be able to install this feature onto my message board. Please try to be very thorough and detailed when describing the steps and the coding involved.

This is almost a hack by itself, but here it goes:

In your navbar template, find:

<tr>
<td class="thead">$vbphrase[search_forums]</td>
</tr>
<tr>
<td class="vbmenu_option" title="nohilite">
<form action="search.php" method="post">
<input type="hidden" name="do" value="process" />
<input type="hidden" name="showposts" value="0" />
<input type="text" class="bginput" name="query" size="20" />$gobutton<br />
</form>
</td>
</tr>
<tr>
<td class="vbmenu_option"><a href="search.php?$session[sessionurl]" accesskey="4">$vbphrase[advanced_search]</a></td>
</tr>

After that add:
<!-- Amazon.com Search Start -->
<tr>
<td class="thead">Search Amazon.com!</td>
</tr>
<tr>
<td class="vbmenu_option" title="nohilite">
<form action="http://www.amazon.com/exec/obidos/external-search">
<input type="text" class="bginput" name="keyword" size="20" />$gobutton<br />
<input type="hidden" name="mode" value="blended" />
<input type="hidden" name="tag" value="YOUR ASSOCIATE ID" />
</form>
</td>
</tr>
<tr>
<td style="background-color:#000;" height="40" align="center"><a href="http://www.amazon.com/exec/obidos/redirect-home/YOUR ASSOCIATE ID"><img src="http://g-images.amazon.com/images/G/01/associates/build-links/ap-search-logo-126x32.gif" height="36" border="0" width="126" /></a></td>
</tr>
<!-- Amazon.com Search End -->

Don't forget to change "YOUR ASSOCIATE ID" with the correct info.

OrangeFlea
02-04-2005, 04:15 PM
Cteselle, thank you so very much!

I was wondering, will it show the amazon.com graphics on the search box display? I want it to look somewhat professional and official.

EDIT: Also, will guests be able to view it?

cteselle
02-04-2005, 04:21 PM
Cteselle, thank you so very much!

I was wondering, will it show the amazon.com graphics on the search box display? I want it to look somewhat professional and official.

EDIT: Also, will guests be able to view it?

The amazon graphic will appear below the search box.

Guests will be able to see it, if you have search turned on for guests.

OrangeFlea
02-04-2005, 06:44 PM
Another question.

This only creates another table for the pre-existing search box. I wanted to make a separate drop-down menu altogether on the navbar. Is it possible for you to provide me with the code that does this?

gregwatson
03-16-2005, 11:28 PM
So is there any way to get this to work with the GAL auto linker hack?

Greg

Installed

amykhar
03-17-2005, 12:12 AM
It's two separate things that you should be able to use together. This hack modifies links, not text. The other hack modifies text, not links.

gregwatson
03-17-2005, 12:30 AM
It's two separate things that you should be able to use together. This hack modifies links, not text. The other hack modifies text, not links.

It's probably just a matter of "sequence" ... right now this won't modify a link that is created by GAL ... I was trying to simply GAL ...

Greg

Adrian Schneider
03-17-2005, 12:38 AM
Sorry this may be kind of off topic, but how does the Amazon associates thing work? Do you place ads? Explain this to stupid old me. :)

twoseven
03-17-2005, 01:58 AM
you get paid to sell amazon products(if they go through your referal)

JustAskJulie
04-13-2005, 06:54 AM
This is cool. I want to look at it and see what it would take to convert it for other affiliate programs.

venomx
04-15-2005, 07:57 AM
Amy,

I found out that Amazon has a RSS feed. Since i run the RSS Bot hack I thought about using it and this hack by you. Will this hack change the links they use in the RSS feed? Heres one link

http://www.amazon.com/exec/obidos/ASIN/B0007VZVG0/ref=nosimRss/webservices-20?dev-t=amznRss

amykhar
04-15-2005, 10:47 AM
It depends on two things:
1. How the bot hack forms the message. You may have to tweak it a bit to make it parse the amazon urls before saving the message.
2. If the RSS feed is set up to already use your affiliate ID, the hack won't change the links again. (which is a good thing)

venomx
04-15-2005, 10:56 AM
Not sure how it does it but it doesnt give them UCash points so I am guessing it just adds te posts right to the database. :(

The RSS feed doesnt use the aff id.. :(

amykhar
04-15-2005, 11:24 AM
ok. Then it will be easy to do.
In the rss bot hack, find the line where it puts the message in the database. Then, above that line, copy the code that I used in functions_newpost.php.

Explicitly:

require_once('./includes/functions_amazon.php');
$post['message'] = process_amazon_links($post['message']);


You might have to change the message variable to match whatever the hack called it. It's April 15 (tax day) and I am busy finializing tax returns for procrastinating clients. So, I can't help you dig through the RSS hack today.

Norbert
04-16-2005, 04:31 PM
Thx for this great hack... will work with the german sites.

Greetings from Vienna,
Norbert

venomx
04-16-2005, 07:54 PM
I took a look but am scared to test because I just know Ill screw it up hehe

SEO Report
04-17-2005, 10:15 PM
Does this hack affects existing posts/links?

Thanks,
-k

amykhar
04-17-2005, 11:03 PM
No. It does not. With VB2 it did, but the way links are show has changed in VB3.

venomx
04-17-2005, 11:16 PM
I dont have this.. I think its because of the Warning Hack I have installed. :(


3. In private.php

Find:
$message = addslashes(fetch_censored_text($pm['message']));

venomx
04-17-2005, 11:19 PM
I have a


$pm['message'] = fetch_censored_text($pm['message']);

This is in there 2 or 3 times.. :(

venomx
04-17-2005, 11:30 PM
Anyone with the ADVANCED WARNING SYSTEM (AWS) hack that figured out where to make the changes for private.php?

venomx
04-18-2005, 04:22 AM
Fixed the private problem. :)
Also I tried messing with the amazom feed with and without adding that code to the RSS Article Bot and it didnt work at all. THe RSS didnt work. :(

SEO Report
04-18-2005, 02:44 PM
No. It does not. With VB2 it did, but the way links are show has changed in VB3.

Too bad, that would be really great to be able to change existing ones! (any taker?)

Thanks for sharing!

-k

amykhar
04-18-2005, 02:49 PM
You COULD change where my hack is run. Instead of running when a post is made and making the changes stick in the database, you COULD run it when the posts are shown instead. This way, they would be converted at display time, which would mean any link gets changed, no matter how old. That is the way it worked under VB2.

I didn't write the hack this way because that adds extra processing time that I felt wasn't worth it. I believe it's better to convert as each post is made, rather than having to reformat the link every time somebody views the post.

Amy

SEO Report
04-19-2005, 05:59 PM
You COULD change where my hack is run. Instead of running when a post is made and making the changes stick in the database, you COULD run it when the posts are shown instead. This way, they would be converted at display time, which would mean any link gets changed, no matter how old. That is the way it worked under VB2.

I didn't write the hack this way because that adds extra processing time that I felt wasn't worth it. I believe it's better to convert as each post is made, rather than having to reformat the link every time somebody views the post.


Good point. Is there an easy way to change this to make it work with the NTTP usenet hack?

-k

amykhar
04-19-2005, 06:25 PM
Gang, I don't have the time to get this working with other hacks that I don't use. I'm sorry but you're going to be on your own to get it working with other people's code.

The good thing is, it's trivial to make this puppy work. You just have to run the post message through my Amazon parser right before the post is entered in the database. It's just a matter of reading your hack code and finding the message variable and passing that to the parser before the database insert.

venomx
04-19-2005, 06:47 PM
Amy I cant register at your support forum.. Gives me a font error message that I cant copy...

amykhar
04-19-2005, 07:02 PM
OK. Try it now. The image verification was goofing up.

venomx
04-22-2005, 04:13 AM
Amy,

Is this right? I posted this link.....
http://www.amazon.com/exec/obidos/tg/browse/-/468646/dealmeinnet-20//002-5061230-3600869

and it changed it to this...

http://www.amazon.com/exec/obidos/tg/browse/-/468646/dealmeinnet-20///ref=nosim/webmasterresou02

It loses the 002-5061230-3600869 and adds a extra /
Not sure but I also think the dealmeinnet-20 part is the persons ID from where I grabbed the link to post to my site.. :(

amykhar
04-22-2005, 10:52 AM
Nope. It's not. It needs to kill the dealmeinnet-20 part or you won't get credit. When you post a link to a product, it does kill any other referral links. But, it may have issues when you post a link to a general page.

amykhar
06-10-2005, 10:11 PM
I have good news and bad news.

First the good news. This hack will be trivial to port over to 3.5 as a plugin. It won't require any code edits on your part when I release it.

Now the bad news. Amazon has changed their affilliate link format again. The links to direct products are working still, but the rest is not. So, those of you who are using this hack are probably seeing a drop in revenue.

I'm working on getting it fixed, but parsing the urls has been less than fun. I'm not sure why Amazon keeps changing how they do their links. You would think they would leave well enough alone.

Amy

amykhar
07-18-2005, 05:07 PM
ported to 3.5
https://vborg.vbsupport.ru/forumdisplay.php?f=166

amykhar
07-19-2005, 02:13 PM
I just added a new zip file called update.php. In it, there is a new version of functions_amazon.php. Please give it a try as it handles the new link formatting style that Amazon now employs. I am running this version of the file on my 3.5 board with no problems. If a few of you 3.0.x guys let me know that it works for you, I will replace the file in the original zip with the new one.

biggazillakilla
08-29-2005, 06:14 AM
I just installed the update, and here are the results.

Random affiliate link found on the web:

http://www.amazon.com/exec/obidos/tg/detail/-/0886852404/qid=1089755945/sr=8-1/ref=old_aff_id/102-3295743-7276134?v=glance&s=books

gets changed to this:

http://www.amazon.com/exec/obidos/ASIN/0886852404//ref=nosim/new_aff_id

which doesn't work. I'm guessing it's the double slashes. But I could be wrong. I did try the URL with only one of those slashes, and it takes me to the product page.

I'm going to look it over to see if I can find anything. But thanks Amy for your contribution. I'll probably head over to your forum to join. :)

biggazillakilla
08-29-2005, 06:23 AM
Well, now that link seems to work. Not sure why...

Let me do some playing around tomorrow with different links to see how it goes. It's getting a little late here.

Thanks again. :)

amykhar
08-29-2005, 10:36 AM
The double slashes don't mess it up on my site. I haven't seen this version of the mod break, but it's not the heavy time for my users to be using it yet.

Amy

lamspoot
01-14-2006, 06:04 PM
Amy, this modification would be absolutely perfect for my site, but I'm having some trouble with it.

I followed your instructions and here's what happens:

Test 1 is where I just copied and pasted a link from amazon into a post.

Test 2 is where I used the Insert Hyperlink button in the post and typed in the text "this is using a hyperlink button in a post".

Can you give me any ideas about what I'll need to change? I'm using vBulletin 3.03.

Thanks for any help you can provide.
Mary

zerokarma
01-23-2006, 02:37 AM
So does this hack work still at all for V3.0.X?

and if so which ZIP do I need? the original one or the update one?

KarateKid
02-07-2006, 09:47 AM
So does this hack work still at all for V3.0.X?

and if so which ZIP do I need? the original one or the update one?

Is there something similiar vor 3.5.x?

biggazillakilla
01-24-2007, 01:53 AM
Is there something similiar vor 3.5.x?Check her page here on vB.org (https://vborg.vbsupport.ru/member.php?u=87) to see what hacks she has for what versions of vB.