| Author |
Topic Search Topic Options
|
kbannon
Groupie
Joined: 03 October 2002
Location: Ireland
Status: Offline
Points: 115
|
Post Options
Thanks(0)
Quote Reply
Topic: Embedding ebay affiliate code 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.
|
 |
MortiOli
Senior Member
Joined: 26 May 2002
Location: United Kingdom
Status: Offline
Points: 514
|
Post Options
Thanks(0)
Quote Reply
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?
|
 |
kbannon
Groupie
Joined: 03 October 2002
Location: Ireland
Status: Offline
Points: 115
|
Post Options
Thanks(0)
Quote Reply
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.
|
 |
Scotty32
Moderator Group
Joined: 30 November 2002
Location: Manchester, UK
Status: Offline
Points: 1682
|
Post Options
Thanks(0)
Quote Reply
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
|
|
|
 |
kbannon
Groupie
Joined: 03 October 2002
Location: Ireland
Status: Offline
Points: 115
|
Post Options
Thanks(0)
Quote Reply
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.
|
 |
kbannon
Groupie
Joined: 03 October 2002
Location: Ireland
Status: Offline
Points: 115
|
Post Options
Thanks(0)
Quote Reply
Posted: 09 May 2007 at 8:01pm |
Anyone?
|
|
I don't suffer from insanity, I enjoy every minute of it.
|
 |
kbannon
Groupie
Joined: 03 October 2002
Location: Ireland
Status: Offline
Points: 115
|
Post Options
Thanks(0)
Quote Reply
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)
Edited by kbannon - 14 May 2007 at 10:15pm
|
|
I don't suffer from insanity, I enjoy every minute of it.
|
 |
MortiOli
Senior Member
Joined: 26 May 2002
Location: United Kingdom
Status: Offline
Points: 514
|
Post Options
Thanks(0)
Quote Reply
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!
|
 |