Embedding ebay affiliate code
Printed From: Web Wiz Forums
Category: Web Wiz Web App Support Forums
Forum Name: Web Wiz Forums Modifications
Forum Description: Mod's and Add-on's for Web Wiz Forums.
URL: https://forums.webwiz.net/forum_posts.asp?TID=23183
Printed Date: 30 March 2026 at 4:19am Software Version: Web Wiz Forums 12.08 - https://www.webwizforums.com
Topic: Embedding ebay affiliate code
Posted By: kbannon
Subject: Embedding ebay affiliate code
Date Posted: 25 April 2007 at 11:59am
I am hoping that this is possible but with the vast array of ebay URLs it may prove difficult. I have been asked about the possibility of changing any ebay links submitted to concatenate an affiliate URL onto the front so that instead of http://cgi.ebay.co.uk/ws/eBayISAPI.dll?... it would be http://affiliate.ebay.com/...&mpre=http://cgi.ebay.co.uk/ws/eBayISAPI.dll?...
Is this possible within the current system? Is it a case of just adding a new filter? How would you trap the entire URL - using spaces? It would have to be done for the various ebay TLDs (.com, .co.uk, .ie, .de...) also. Thanks
------------- I don't suffer from insanity, I enjoy every minute of it.
|
Replies:
Posted By: MortiOli
Date Posted: 25 April 2007 at 12:26pm
|
Just out of interest, what does this gain by putting an affiliate code at the start? Does ebay pay you money etc?
|
Posted By: kbannon
Date Posted: 25 April 2007 at 12:32pm
yup - they pay a percentage of the sales figure
------------- I don't suffer from insanity, I enjoy every minute of it.
|
Posted By: Scotty32
Date Posted: 25 April 2007 at 8:44pm
it may be best to have a function to detect it in the forum_posts.asp page
as if you do it durin adding the post to the DB any time its edited it adds it again. or the user can just remove it?
i would look at the current functions for example the Flash one?
change it from looking for "[FLASH" to "<a href=""http://cgi.ebay""
this might be quite easy to do
------------- S2H.co.uk - http://www.s2h.co.uk/wwf/" rel="nofollow - WebWiz Mods and Skins
For support on my mods + skins, please use http://www.s2h.co.uk/forum/" rel="nofollow - my forum .
|
Posted By: kbannon
Date Posted: 30 April 2007 at 11:07pm
I inserted a replace function to trap "http://cgi.ebay." and that works fine. However, it seems that the original ebay link must be encoded and then appended onto the affiliate link. How would I manage to encode that portion? I guess I need to find the next space after "http://cgi.ebay." presumably using some mix of Instr() but how would I cope with the dynamic lengths and repeated occurneces?
------------- I don't suffer from insanity, I enjoy every minute of it.
|
Posted By: kbannon
Date Posted: 09 May 2007 at 8:01pm
Anyone?

------------- I don't suffer from insanity, I enjoy every minute of it.
|
Posted By: kbannon
Date Posted: 14 May 2007 at 10:14pm
I solved it in the end - I used a regular expression to pick out certain words in a string and then replace the matches with encoded versions of the same and then append the affiliate link onto the encoded URL (as per ebay instructions).
<% Function EncodeEbayHyperlinks(inText) Dim objRegExp, strBuf, ebayAffiliateURL Dim objMatches, objMatch Dim Value, ReplaceValue, iStart, iEnd
ebayAffiliateURL = "http://rover.ebay.com/rover/1/711-1751-2978-71/1?AID=5463217&PID=2399323&mpre=" strBuf = "" iStart = 1 iEnd = 1 Set objRegExp = New RegExp
objRegExp.Pattern = "\b(http\://stores.ebay\.|http\://www.ebay\.|http\://cgi\.ebay\.|stores.ebay\.|www.ebay\.|ebay\.|cgi\.ebay\.)\S+\b" objRegExp.IgnoreCase = True ' Set case insensitivity. objRegExp.Global = True ' Set global applicability. Set objMatches = objRegExp.Execute(inText) For Each objMatch in objMatches iEnd = objMatch.FirstIndex strBuf = strBuf & Mid(inText, iStart, iEnd-iStart+1) strBuf = strBuf & ebayAffiliateURL & Server.UrlEncode(objMatch.Value) iStart = iEnd+objMatch.Length+1 Next strBuf = strBuf & Mid(inText, iStart) EncodeEbayHyperlinks = strBuf Set objRegExp = Nothing End Function %> |
I then just replaced my strMessage (or whatever the variable the forum posts are) with EncodeEbayHyperlinks(strMessage)
------------- I don't suffer from insanity, I enjoy every minute of it.
|
Posted By: MortiOli
Date Posted: 26 June 2007 at 9:10pm
|
kbannon, any chance you could release this as a mod, with full instructions on implementation?
If it makes me money, I'm up for implementing it :-)
I take it, it doesn't affect anything else?
Cheers!
|
Posted By: kbannon
Date Posted: 28 June 2007 at 12:24am
I'll draw up instructions in the next day or so.
------------- I don't suffer from insanity, I enjoy every minute of it.
|
Posted By: MortiOli
Date Posted: 29 June 2007 at 9:18am
|
Cheers kbannon, that would be great.
|
Posted By: kbannon
Date Posted: 06 July 2007 at 9:43pm
eventually: Im using version 7.9 still so line numbers may differ for V8.x or V9.x
at the top of forum_posts.asp add in the following (just below "<!--#include file="includes/emoticons_inc.asp" -->" on or about line 8 (my code has been tweaked that:
<% Function EncodeEbayHyperlinks(inText) Dim objRegExp, strBuf, ebayAffiliateURL Dim objMatches, objMatch Dim Value, ReplaceValue, iStart, iEnd
ebayAffiliateURL = "http://rover.ebay.com/rover/1/711-1751-2978-71/1?AID=5463217&PID=2399323&mpre=" strBuf = "" iStart = 1 iEnd = 1 Set objRegExp = New RegExp objRegExp.Pattern = "\b(http\://stores.ebay\.|http\://www.ebay\.|http\://cgi\.ebay\.|stores.ebay\.)\S+\b" objRegExp.IgnoreCase = True ' Set case insensitivity. objRegExp.Global = True ' Set global applicability. Set objMatches = objRegExp.Execute(inText) For Each objMatch in objMatches iEnd = objMatch.FirstIndex strBuf = strBuf & Mid(inText, iStart, iEnd-iStart+1) strBuf = strBuf & ebayAffiliateURL & replace(Server.UrlEncode(objMatch.Value), "%26amp%3B", "%26") iStart = iEnd+objMatch.Length+1 Next strBuf = strBuf & Mid(inText, iStart) EncodeEbayHyperlinks = strBuf Set objRegExp = Nothing End Function %>
|
On line 854 (of my modded code!) before the following block of code:
Response.Write(vbCrLf & " </td>" & _ vbCrLf & " </tr>" & _ vbCrLf & " <tr>" & _ vbCrLf & " <td colspan=""2""><hr /></td>" & _ vbCrLf & " </tr>" & _ vbCrLf & " </table>" & _ vbCrLf & "<!-- Message body -->" & vbCrLf & strMessage & vbCrLf & "<!-- Message body ''"""" -->" & _ etc. |
add the following:
'###################################################### '#### ebay link hack '######################################################
strmessage = EncodeEbayHyperlinks(strMessage)
|
Points to note: * My code has been modified so line numbers are not accurate * The variable named ebayAffiliateURL holds my ebay affiliate link is in red - replace it with yours or else i will earn your commission (if any!) * As I previously said, this is for WWF version 7.9 - check the code in version 8 onwards for compatibility - maybe someone will be able to show correct line numbers. * this doesn't change text before it is inserted into the database - it replaces text before after it is selected out and served in the HTML to the user. * how it works: the function is called via the line strmessage = EncodeEbayHyperlinks(strMessage) with the entire message as an argument for the function. The function uses VBScript regular expressions to find references of the following:
http://stores.ebay. http://www.ebay. http://cgi.ebay. stores.ebay. (note that the '.' and ':' are escaped using a backslash (\))
Once these are found within your message the enay affiliate part of the link is placed in front of it.
If you have any queries about this, just post them here. Oh and despite all the hassle of creating this, I have made (so far) a measly UK£0.41 
------------- I don't suffer from insanity, I enjoy every minute of it.
|
Posted By: kbannon
Date Posted: 06 July 2007 at 10:05pm
incidentally, to join ebay's affiliate partnership, sign up at http://affiliates.ebay.com - - affiliates.ebay.com
------------- I don't suffer from insanity, I enjoy every minute of it.
|
|