1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
  2. This forum has been archived. New threads and replies may not be made. All add-ons/resources that are active should be migrated to the Resource Manager. See this thread for more information.

UrlRewriter ( Auto Media Embed and Affiliate Schemes )

Discussion in 'Add-on Releases [Archive]' started by buro9, Nov 21, 2010.

  1. buro9

    buro9 Active Member

    OK, So I loved the Auto Media Embed that a lot of other forums have got, and I wanted to add that to XenForo, but I also have hacked into my own forums stuff to enable affiliate schemes... all of which is the same thing: Re-writing tags to output custom HTML depending on the href="" bit.

    So, this is a *very early* release of a URL Rewriter. Right now I'm releasing it solely to get other people interested in helping to build definitions for it... I also need to shift the definitions to a separate file and provide an update framework. To get the UrlWriter either download from this thread (I'll update it periodically whenever changes have been tested) or for the very latest dev version there is a GitHub repository:

    https://github.com/buro9/XenForo-UrlRewriter

    Anyone wishing to add definitions should simply request to be a collaborator on the GitHub project or post the details in this thread.

    Screenshots

    1.png 2.png 3.png 4.png

    The github readme:

    XenForo UrlRewriter

    UrlRewriter is a XenForo application to allow forum owners to enable auto media embed functionality and to implement affiliate schemes.

    XenForo [ url ] tags are rewritten at the time of render, which adds a slight processing overhead (whilst XenForo does not have a post_parsed cache) but does mean that the underlying post is unmodified = this application will not edit anything in your database and is guaranteed to be non-damaging in any way.

    Installation

    To install:
    1. Download and extract the .zip file from: https://github.com/buro9/XenForo-UrlRewriter/zipball/master
    2. Upload the files in UrlRewriter directory into your XenForo /library/ directory on your web server.
    3. Add the Add-on in your Admin Dashboard under Home > Add-ons > Install Add-on, browse to the addon_UrlRewriter.xml and click "Install Add-on".
    To test that it's working, just create a post on the forum with this URL in the body:
    4. "Like" this post to show you've installed the Add-on.​
    Supported Sites

    Currently Supported Site - Test URL:

    • Affiliate Schemes
      • Amazon (all countries)
      • eBay (pick a region)
    • Maps and Fitness
      • Bikely
      • Bikemap
      • Every Trail
      • Garmin Connect
      • GPSies
    • Audio
      • Sound Cloud
    • Video
      • YouTube HD
      • YouTube
      • YouTube Short URL HD
      • YouTube Short URL
    Affiliate Replacements


    Currently for the affiliate schemes you will need to edit the replacements found within the /UrlRewriter/BbCode/Formatter/Base.php file to insert your tracking tag.

    When this addon has matured a little an interface will be provided for you to do this without having to edit the code.

    The replacements for affiliates:

    Within the Amazon replacement:

    Code:
    Change the URL tag 'buro9' to your Amazon tracking code.
    Within the eBay replacement:

    There are a few bits you need to replace:

    After "/rover/1/" you need to put in the Placement ID for your region, default is the UK eBay so you may need to change that:

    Code:
    eBay AU = 705-53470-19255-0
    eBay BE = 1553-53471-19255-0
    eBay CA = 706-53473-19255-0
    eBay ES = 1185-53479-19255-0
    eBay FR = 709-53476-19255-0
    eBay HK = 3422-53475-19255-0
    eBay IN = 4686-53472-19255-0
    eBay IT = 724-53478-19255-0
    eBay NL = 1346-53482-19255-0
    eBay SG = 3423-53474-19255-0
    eBay UK = 710-53481-19255-0
    eBay US = 711-53200-19255-0
    Half US = 8971-56017-19255-0
    
    You need to change this bit to include your Campaign ID:

    Code:
    campid=5336525415
    Contributing

    Do you want to submit a URL rewrite definition for a site? Then this is what we need:

    1. A regular expression that will take the URL and match URLs for your given site:

    Code:
    http://www.gpsies.com/map.do\?fileId=([\w\d_-] )
    2. Some HTML to replace that with:

    Code:
    <a href="[ URL ]">[NAME]</a><br /><iframe src="http://www.gpsies.com/mapOnly.do?fileId=${1}" width="[WIDTH]" height="[HEIGHT]" frameborder="0" scrolling="no" marginheight="0" marginwidth="0"></iframe> 
    You have at your disposal these values:

    • [ URL ] = The original pre-processed URL
    • [CACHEBUSTER] = A random numerical digit, mostly to be used to ensure that a URL is not cached
    • [NAME] = The bit of text that would've appeared between the `<a>` tags `</a>`.
    • [WIDTH] = The hard-coded default width for all embeds = 425
    • [HEIGHT] = The hard-coded default height for all embeds = 300
    3. An example test URL: http://www.gpsies.com/map.do?fileId=ckhtmmzhuivpjgdi Send this information to david@buro9.com with the subject "XenForo UrlRewriter Definition".

    Test URLs

    It is not advised to put all of these into a single post... it would result in a lot of embedded items, flash players and iframes.

    Code:
    http://www.amazon.co.uk/Lighted-Leather-Burgundy-Display-Generation/dp/B003DZ166Q/ref=br_lf_m_1000425123_1_3_ttl?ie=UTF8&s=electronics&pf_rd_p=217325627&pf_rd_s=center-3&pf_rd_t=1401&pf_rd_i=1000425123&pf_rd_m=A3P5ROKL5A1OLE&pf_rd_r=052A7YB9W01ZB6HXKBQQ http://cgi.ebay.co.uk/Colnago-C40-full-Campagnolo-Record-carbone_W0QQitemZ130457071957QQcategoryZ98084QQcmdZViewItemQQ_trksidZp5197.m7QQ_trkparmsZalgo=LVI&itu=UCI&otn=2&po=LVI&ps=63&clkid=5117350348837181446#ht_1164wt_881 http://www.bikely.com/maps/bike-path/Princes-Risborough-80km http://www.bikemap.net/route/714312 http://www.everytrail.com/view_trip.php?trip_id=723506 http://connect.garmin.com/activity/55877482 http://www.gpsies.com/map.do?fileId=ckhtmmzhuivpjgdi http://soundcloud.com/ronniepollock/dysfunctional-tb303-dont-leave-me-tonight http://www.youtube.com/watch?v=U0CGsw6h60k&hd=1 http://www.youtube.com/watch?v=U0CGsw6h60k http://youtu.be/U0CGsw6h60k?hd=1 http://youtu.be/U0CGsw6h60k 
    Views on the .zip file below are low as every time a definition is added the .zip file is replaced and this resets the number. People are downloading it :)
     
    racersimage, DRE, Kelso and 19 others like this.
  2. Floris

    Floris Guest

    Thanks for sharing :)
     
  3. buro9

    buro9 Active Member

    Benefits us all, besides... writing definitions is going to be the time-consuming bit and the authors of definitions from other forums appear to claimed copyright for theirs (I'm not even sure whether you can copyright a regexp and some HTML). So opening it up and sharing widely should help to build the definitions to make this really useful.

    I'll start building some definitions now and will work on improving what is really happen later.
     
  4. buro9

    buro9 Active Member

  5. buro9

    buro9 Active Member

    Hey Floris, do you have any mod powers on here? Could I get the thread title edited so that there is a space between the ( and the word Auto... search doesn't like it.
     
  6. buro9

    buro9 Active Member

    Updated with definitions for the latest YouTube embed code and with the YouTube short URLs (youtu.be).
     
  7. buro9

    buro9 Active Member

    Added an Amazon affiliate definition. Currently it has my tracking tag "buro9", feel free to change that. An interface for editing tracking tags will come after I have tested in anger the re-writing (and the impact of having many definitions).
     
    Crazyfruitbat and ArnyVee like this.
  8. Nasr

    Nasr Well-Known Member

    Great job. I'm really amazed how contributors here are relentless and generious. This community is very very promising.
     
  9. buro9

    buro9 Active Member

    It's a 2-way benefit this: This is how my forums fund themselves (affiliates) and this is what makes a lot of the content captivating (rich embedded stuff, which is simple for people to do).

    It makes sense to share as the definitions will take a lot of work. Any help is appreciated.
     
  10. manik

    manik Member

    Very nice buro9, This is a great feature and am so very happy to see it being adapted over.
     
  11. Brogan

    Brogan XenForo Moderator Staff Member

    Edited :)
     
  12. buro9

    buro9 Active Member

    Many thanks... working on the eBay URL this evening... holy crap they have more ways than Amazon for creating URLs. Thankfully they appear to have a simple way to re-write them though.

    ToDo List (feel free to append any requests):
    * eBay
    * Sound Cloud
     
  13. ArnyVee

    ArnyVee Well-Known Member

    Couple of other suggestions....
    • Shop.com
    • BarnesAndNoble.com
    • Expedia.com
     
  14. buro9

    buro9 Active Member

    Great, do you have example URLs of those and ideally a before and after thing?

    Some may be obvious, but I'm not sure what you'd want with the Expedia one... is that an affiliate thing? Media embedding tends to be obvious, whereas affiliates are less so and I'd need some good examples.

    From the github docs I've uploaded:

    Do you want to submit a URL rewrite definition for a site? Then this is what we need:

    1) A regular expression that will take the URL and match URLs for your given site:

    i.e.:
    Code:
    http://www.gpsies.com/map.do\?fileId=([\w\d_-]+)
    2) Some HTML to replace that with:

    i.e.:
    HTML:
    <a href="[URL]">[NAME]</a><br /><iframe src="http://www.gpsies.com/mapOnly.do?fileId=${1}&quot; width="[WIDTH]" height="[HEIGHT]" frameborder="0" scrolling="no" marginheight="0" marginwidth="0"></iframe>
    You have at your disposal these values:
    • [ URL ] = The original pre-processed URL
    • [NAME] = The bit of text that would've appeared between the <a> tags </a>.
    • [WIDTH] = The hard-coded default width for all embeds = 425
    • [HEIGHT] = The hard-coded default height for all embeds = 300
    3) An example test URL:

    i.e.:
    Code:
    http://www.gpsies.com/map.do?fileId=ckhtmmzhuivpjgdi
     
  15. buro9

    buro9 Active Member

    I'm fine with working out regexps but will need to see example URLs and the desired output in HTML.
     
  16. ArnyVee

    ArnyVee Well-Known Member

    Buro9, I'm actually good with the Amazon and eBay links. Just thought I'd share a couple of other popular ones that may be good for you to research and add :D

    The only other one that I've used in the past is AllPosters.com and that may be another one that we could add. But, I'd have to dig up some examples as I had that done awhile back.
     
  17. buro9

    buro9 Active Member

    Cool, well I've just signed up to the Expedia program to get access to their tools to see if I could work out how they build their URLs. I'll check out some of the others too...

    The current ToDo list then:
    • Affiliates
      • AllPosters.com
      • Barnes & Noble
      • eBay Partner Network (with Impressions tracking)
      • Expedia
      • Shop.com
    • Media Embed
    It is also possible to anonymise clicks too, simply by pre-pending a URL with http://anonym.to/? but I shall just leave that in the documentation and if people are running sites on which they feel they want to anonymise click-throughs then they can use it as they see fit.
     
  18. buro9

    buro9 Active Member

    I've added Sound Cloud but at the moment it's not working properly even though I've followed their blog post. So I've emailed their API team and when I get it working I'll let you know.
     
  19. buro9

    buro9 Active Member

    Added eBay and it's working... non-trivial to customise right now, but I'll start work on a management interface soon to make that easy.

    eBay instructions:

    There are a few bits you need to replace within the replacement HTML:

    After "/rover/1/" you need to put in the Placement ID for your region, default is the UK eBay:

    eBay AU = 705-53470-19255-0
    eBay BE = 1553-53471-19255-0
    eBay CA = 706-53473-19255-0
    eBay ES = 1185-53479-19255-0
    eBay FR = 709-53476-19255-0
    eBay HK = 3422-53475-19255-0
    eBay IN = 4686-53472-19255-0
    eBay IT = 724-53478-19255-0
    eBay NL = 1346-53482-19255-0
    eBay SG = 3423-53474-19255-0
    eBay UK = 710-53481-19255-0
    eBay US = 711-53200-19255-0
    Half US = 8971-56017-19255-0

    You need to change this bit to include your Campaign ID:

    campid=5336525415
     
  20. buro9

    buro9 Active Member

    Uploaded the newest version with the eBay partner network code.
     

Share This Page