​​​​​

share​ ​n​ ​earn

​​​

   

Version:​ ​1.05  Release:​ ​21​ ​Mar​ ​2012                                            ​ ​ ​ ​ ​ ​Copyright​ ​©​ ​2012​ ​RMP​ ​Protection​ ​Limited                ​ ​ ​ ​ ​ ​ ​ ​ ​ ​1   

 

Table​ ​of​ ​Contents   

1​ ​Introduction 

2​ ​Major​ ​Points 

What​ ​does​ ​a​ ​Merchant​ ​need​ ​to​ ​do? 

What​ ​does​ ​an​ ​Affiliate​ ​need​ ​to​ ​do?  Summary 

3​ ​Details​ ​of​ ​Merchant​ ​requirements  4​ ​Theoretical​ ​Example 

What​ ​gets​ ​posted​ ​on​ ​a​ ​social​ ​site?  Constructing​ ​the​ ​sales​ ​page 

5​ ​Case​ ​study:​ ​CarrotBid​ ​–​ ​a​ ​Facebook​ ​application  share-n-earn​ ​Button  Publishing​ ​the​ ​link 

Accessing​ ​the​ ​link​ ​from​ ​a​ ​news​ ​feed  User​ ​purchases 

Appendix​ ​A​ ​–​ ​A​ ​PHP​ ​generated​ ​page​ ​that​ ​processes​ ​an​ ​affiliate​ ​URL   

Appendix​ ​B​ ​–​ ​A​ ​function​ ​to​ ​calculate​ ​the​ ​price​ ​attribute 

1​ ​Introduction

share​-n-​earn​​ ​(S-N-E),​ ​is​ ​a​ ​free​ ​micro-affiliate​ ​network​ ​service​ ​for​ ​web​ ​sites​ ​(merchants),​ ​who​ ​wish​ ​to promote​ ​selected​ ​sales​ ​items​ ​or​ ​their​ ​site​ ​as​ ​a​ ​whole.​ ​A​ ​merchant​ ​signifies​ ​their​ ​willingness​ ​to​ ​share​ ​sales revenue​ ​with​ ​a​ ​micro-affiliate​ ​by​ ​the​ ​inclusion​ ​of​ ​a​ ​S-N-E​ ​→​ ​

​ ​button.

Use​ ​of​ ​this​ ​button​ ​by​ ​a​ ​potential​ ​affiliate​ ​creates​ ​a​ ​custom​ ​version​ ​of​ ​a​ ​URL​ ​supplied​ ​by​ ​the​ ​merchant (known​ ​as​ ​an​ ​'affiliate​ ​URL'),​ ​to​ ​be​ ​posted​ ​on​ ​the​ ​affiliate's​ ​social​ ​network​ ​page,​ ​sent​ ​in​ ​an​ ​email​ ​or​ ​posted on​ ​the​ ​affiliate's​ ​own​ ​web​ ​site.​ ​If​ ​subsequent​ ​use​ ​of​ ​this​ ​URL​ ​results​ ​in​ ​a​ ​sale​ ​for​ ​the​ ​merchant,​ ​the​ ​merchant agrees​ ​to​ ​split​ ​the​ ​sales​ ​revenue​ ​with​ ​the​ ​affiliate.

2​ ​Major​ ​Points 1. 2. 3. 4. 5.

Sale​ ​must​ ​be​ ​completed​ ​through​ ​CarrotPay Merchant​ ​only​ ​pays​ ​when​ ​sale​ ​is​ ​completed Merchant​ ​determines​ ​the​ ​terms​ ​of​ ​the​ ​revenue​ ​split Merchant​ ​need​ ​not​ ​know​ ​who​ ​the​ ​micro-affiliate​ ​is​ ​(i.e.​ ​no​ ​sign-up​ ​is​ ​required) Affiliate​ ​settlement​ ​is​ ​made​ ​automatically​ ​through​ ​CarrotPay

What​ ​does​ ​a​ ​Merchant​ ​need​ ​to​ ​do?

1. Include​ ​two​ ​Javascript​ ​libraries​ ​on​ ​each​ ​sales​ ​pages.

2. Add​ ​the​ ​share​-n-​earn​ ​ button​ ​to​ ​each​ ​product​ ​or​ ​to​ ​the​ ​site​ ​as​ ​a​ ​whole. 3. Process​ ​an​ ​affiliate​ ​URL​ ​when​ ​activated​ ​by​ ​a​ ​buyer​ ​and​ ​construct​ ​a​ ​page​ ​with​ ​an​ ​appropriate ​ ​ ​ ​ ​ ​ ​ ​ ​ ​2   

 

CarrotPay​ ​buy​ ​button.

What​ ​does​ ​a​ ​micro-affiliate​ ​need​ ​to​ ​do? Each​ ​time​ ​they​ ​want​ ​to​ ​promote​ ​a​ ​product:​ ​click​ ​on​ ​a​ ​ ​

​ ​button​ ​and​ ​post​ ​the​ ​affiliate​ ​URL.

Once​ ​only:​ ​ ​get​ ​a​ ​Carrot-WebPurse.​ ​Can​ ​be​ ​as​ ​a​ ​result​ ​of​ ​clicking​ ​the​ ​ ​

​ ​button.

Summary A​ ​merchant​ ​may​ ​place​ ​a​ ​share​-n-​earn​​ ​button​ ​next​ ​to​ ​any​ ​content​ ​they​ ​wish​ ​to​ ​be​ ​promoted​ ​through micro-affiliates.​ ​Affiliates​ ​may​ ​post​ ​a​ ​custom​ ​affiliate​ ​URL​ ​for​ ​the​ ​content​ ​anywhere​ ​on​ ​the​ ​web.​ ​When​ ​a buyer​ ​uses​ ​an​ ​affiliate​ ​URL,​ ​the​ ​originating​ ​merchant​ ​agrees​ ​to​ ​split​ ​any​ ​sales​ ​revenue​ ​with​ ​the micro-affiliate​ ​who​ ​posted​ ​it.​ ​CarrotPay​ ​will​ ​settle​ ​the​ ​split​ ​with​ ​the​ ​micro-affiliate​ ​automatically​ ​so​ ​the merchant​ ​need​ ​do​ ​nothing​ ​extra​ ​after​ ​the​ ​sale​ ​is​ ​complete. 

3​ ​Details​ ​of​ ​Merchant​ ​requirements   

1. A​ ​merchant​ ​must​ ​include​ ​the​ ​following​ ​two​ ​JavaScript​ ​libraries:    

   

  2. ​ ​Add​ ​a​ ​link​ ​for​ ​each​ ​item​ ​to​ ​be​ ​promoted. 

The​ ​​ ​tag​ ​must​ ​include​ ​a​ ​class=“carrot-share-n-earn-button”​ ​and​ ​at​ ​least​ ​the​ ​data-link​ ​and​ ​data-title  attributes.​ ​It​ ​may​ ​also​ ​optionally​ ​include​ ​a​ ​scheme,​ ​earn​ ​or​ ​cobrand​ ​attribute​ ​as​ ​needed.    Attribute​ ​name

Description​ ​of​ ​attribute​ ​value

data-link

A​ ​URL​ ​that​ ​allows​ ​the​ ​merchant​ ​to​ ​determine​ ​what​ ​is​ ​being​ ​promoted. Example​ ​-​ ​“http://www.asite.com/affiliate-sale?prod=1234”

data-title

A​ ​short​ ​description​ ​of​ ​the​ ​thing​ ​being​ ​promoted. Example​ ​-​ ​“A​ ​funny​ ​video”

data-cobrand

OPTIONAL:​ ​A​ ​short​ ​name​ ​to​ ​be​ ​displayed​ ​during​ ​the​ ​sharing​ ​process.​ ​Defaults​ ​to​ ​the domain​ ​name​ ​of​ ​the​ ​host​ ​site.

data-earn

OPTIONAL:​ ​A​ ​very​ ​brief​ ​description​ ​of​ ​the​ ​sharing​ ​scheme.​ ​Defaults​ ​to​ ​blank. Example​ ​-​ ​“Earn​ ​10%”

data-scheme

OPTIONAL:​ ​The​ ​URL​ ​of​ ​a​ ​page​ ​describing​ ​the​ ​merchant's share​-n-​earn​​ ​scheme.​ ​This​ ​URL​ ​may​ ​be​ ​activated​ ​by​ ​an​ ​affiliate​ ​by​ ​clicking​ ​an information​ ​icon​ ​provided​ ​in​ ​the​ ​share​-n-​earn​​ ​widget.​ ​If​ ​not​ ​provided​ ​the​ ​affiliate​ ​will​ ​be sent​ ​to​ ​a​ ​generic​ ​description​ ​of​ ​the​ ​service​ ​hosted​ ​by​ ​carror.org. Example​ ​-​ ​“http://www.asite.com/shareNearn.html”

​ ​ ​ ​ ​ ​ ​ ​ ​ ​3   

 

Table​ ​3.1​ ​Attribute​ ​description. 3. Process​ ​the​ ​affiliate​ ​URL​ ​and​ ​create​ ​a​ ​CarrotPay​ ​buy​ ​button. S-N-E​ ​will​ ​add​ ​an​ ​extra​ ​parameter​ ​called​ ​'aff'​ ​to​ ​the​ ​data-link​ ​URL​ ​before​ ​a​ ​micro-affiliate​ ​can​ ​post​ ​it. This​ ​attribute​ ​holds​ ​the​ ​id​ ​of​ ​the​ ​micro-affiliate​ ​and​ ​is​ ​ultimately​ ​used​ ​by​ ​CarrotPay​ ​when​ ​splitting​ ​the payment.​ ​When​ ​a​ ​buyer​ ​clicks​ ​an​ ​affiliate​ ​URL,​ ​the​ ​merchant​ ​must​ ​check​ ​for​ ​the​ ​'aff'​ ​attribute​ ​and construct​ ​a​ ​CarrotPay​ ​payment​ ​object​ ​with​ ​the​ ​appropriate​ ​micro-affiliate​ ​id​ ​included​ ​(see​ ​following example).

4​ ​Theoretical​ ​Example

Suppose​ ​a​ ​specialist​ ​ski​ ​news​ ​site​ ​is​ ​selling​ ​individual​ ​in​ ​depth​ ​product​ ​reviews​ ​and​ ​wishes​ ​to​ ​use micro-affiliates​ ​to​ ​increase​ ​sales.​ ​The​ ​site​ ​sells​ ​each​ ​review​ ​for​ ​EUR0.5​ ​and​ ​is​ ​willing​ ​to​ ​pay​ ​each micro-affiliate​ ​15%​ ​of​ ​the​ ​sale​ ​price​ ​(i.e.​ ​7.5¢),​ ​if​ ​they​ ​can​ ​get​ ​a​ ​paying​ ​customer​ ​to​ ​the​ ​site. The​ ​share​-n-​earn​​ ​link​ ​for​ ​a​ ​particular​ ​review​ ​may​ ​look​ ​something​ ​like​ ​this:  


  Once​ ​the​ ​page​ ​is​ ​loaded​ ​into​ ​a​ ​browser,​ ​each​ ​​ ​tag​ ​with​ ​a​ ​class​ ​of​ ​'carrot-share-n-earn-button'​ ​will​ ​be replaced​ ​by​ ​the​ ​familiar​ ​share​-n-​earn​​ ​icon.​ ​The​ ​promotion​ ​for​ ​this​ ​review​ ​might​ ​look​ ​something​ ​like​ ​this: When​ ​an​ ​affiliate​ ​clicks​ ​the​ ​share​-n-​earn​​ ​icon,​ ​a​ ​widget​ ​will​ ​be​ ​displayed​ ​with​ ​the​ ​following​ ​details:

When​ ​the​ ​mouse​ ​hovers​ ​over​ ​the​ ​SHARE​​ ​icon,​ ​it​ ​will​ ​display​ ​like​ ​this:

​ ​ ​ ​ ​ ​ ​ ​ ​ ​4   

 

The​ ​share​-n-​earn​​ ​widget​ ​uses​ ​the​ ​familiar​ ​'AddThis'​ ​component​ ​to​ ​post​ ​the​ ​link​ ​to​ ​a​ ​variety​ ​of​ ​social​ ​sites​ ​or email.

What​ ​gets​ ​posted​ ​on​ ​a​ ​social​ ​site?

Sites​ ​may​ ​vary​ ​in​ ​the​ ​way​ ​they​ ​pick​ ​up​ ​data​ ​that​ ​is​ ​posted​ ​along​ ​with​ ​the​ ​affiliate​ ​URL.​ ​Facebook​ ​for example​ ​(as​ ​at​ ​the​ ​time​ ​of​ ​writing),​ ​fetches​ ​the​ ​affiliate​ ​URL​ ​and​ ​scans​ ​it​ ​for​ ​the​ ​first​ ​

​ ​element​ ​and​ ​the first​ ​10​ ​​ ​elements.​ ​The​ ​contents​ ​of​ ​the​ ​

​ ​element​ ​(if​ ​present),​ ​is​ ​used​ ​to​ ​describe​ ​the​ ​post​ ​and​ ​the micro-affiliate​ ​may​ ​also​ ​enter​ ​some​ ​additional​ ​text.​ ​The​ ​micro-affiliate​ ​may​ ​additionally​ ​select​ ​one​ ​of​ ​the​ ​10 images​ ​(if​ ​present),​ ​to​ ​be​ ​included​ ​along​ ​with​ ​the​ ​text.

After​ ​clicking​ ​the​ ​Share​ ​button,​ ​the​ ​following​ ​item​ ​will​ ​be​ ​posted​ ​to​ ​the​ ​micro-affiliate's​ ​wall​ ​on​ ​Facebook​ ​and will​ ​be​ ​sent​ ​to​ ​all​ ​the​ ​micro-affiliates​ ​friends.

​ ​ ​ ​ ​ ​ ​ ​ ​ ​5   

 

When​ ​a​ ​micro-affiliate's​ ​friend​ ​clicks​ ​the​ ​image​ ​or​ ​the​ ​title,​ ​they​ ​are​ ​taken​ ​to​ ​the​ ​page​ ​referenced​ ​by​ ​the affiliate​ ​URL​ ​on​ ​the​ ​www.ski-news.com​ ​site.​ ​Ski-news​ ​must​ ​use​ ​server-side​ ​code​ ​to​ ​process​ ​the​ ​URL​ ​to recover​ ​the​ ​product​ ​and​ ​micro-affiliate​ ​information.​ ​In​ ​this​ ​example​ ​the​ ​review​ ​of​ ​interest​ ​is​ ​referenced​ ​by​ ​the 'review'​ ​parameter​ ​and​ ​the​ ​micro-affiliate​ ​id​ ​is​ ​held​ ​in​ ​the​ ​'aff'​ ​parameter​ ​as​ ​always.

Constructing​ ​the​ ​sales​ ​page

Having​ ​recovered​ ​the​ ​review​ ​id​ ​and​ ​the​ ​micro-affiliate​ ​id,​ ​it​ ​should​ ​be​ ​a​ ​relatively​ ​simple​ ​matter​ ​to​ ​create​ ​a custom​ ​sales​ ​page​ ​using​ ​any​ ​server-side​ ​language​ ​such​ ​as​ ​PHP​ ​or​ ​Java.

In​ ​this​ ​example​ ​the​ ​promotional​ ​teaser​ ​is​ ​similar​ ​to​ ​that​ ​presented​ ​earlier​ ​but​ ​the​ ​data​ ​behind​ ​the​ ​buy​ ​button (in​ ​this​ ​case​ ​the​ ​'Read​ ​now​ ​EU​ ​50¢​ ​link),​ ​is​ ​different​ ​because​ ​CarrotPay​ ​must​ ​be​ ​informed​ ​that​ ​the micro-affiliate​ ​is​ ​to​ ​receive​ ​15%​ ​of​ ​the​ ​sale.​ ​This​ ​is​ ​achieved​ ​by​ ​changing​ ​the​ ​'price'​ ​attribute​ ​of​ ​the JavaScript​ ​Carrot.pay()​ ​function. For​ ​a​ ​normal​ ​sale​ ​the​ ​price​ ​attribute​ ​would​ ​be​ ​set​ ​like​ ​this:    price​ ​:​ ​"0.5:EUR" 

  When​ ​a​ ​micro-affiliate​ ​is​ ​included​ ​the​ ​price​ ​attribute​ ​needs​ ​to​ ​be​ ​changed​ ​to:   price​ ​:​ ​"0.425:EUR+0.075:EUR:BMWM-VJQB-LVJC-HKQW" 

  This​ ​tells​ ​CarrotPay​ ​to​ ​take​ ​a​ ​total​ ​of​ ​EUR​ ​0.5​​ ​and​ ​credit​ ​the​ ​site​ ​merchant​ ​with​ ​EUR​ ​0.425​​ ​and credit​ ​EUR​ ​0.075​​ ​to​ ​the​ ​micro-affiliate​ ​with​ ​id​ ​BMWM-VJQB-LVJC-HKQW​. NOTE:​​ ​When​ ​checking​ ​the​ ​authorisation​ ​hash​ ​which​ ​is​ ​returned​ ​from​ ​CarrotPay,​ ​the​ ​price​ ​attribute​ ​is included​ ​in​ ​the​ ​calculation.​ ​If​ ​micro-affiliate(s)​ ​are​ ​included​ ​in​ ​the​ ​price,​ ​then​ ​the​ ​hash​ ​will​ ​be calculated​ ​differently​ ​for​ ​each​ ​different​ ​micro-affiliate.​ ​For​ ​this​ ​reason​ ​be​ ​sure​ ​you​ ​can​ ​recreate​ ​the price​ ​attribute​ ​exactly​ ​as​ ​it​ ​was​ ​sent​ ​to​ ​CarrotPay.

5​ ​Case​ ​study:​ ​CarrotBid​ ​–​ ​a​ ​Facebook​ ​application

CarrotBid​ ​is​ ​an​ ​auction​ ​application​ ​hosted​ ​on​ ​Facebook​ ​and​ ​uses​ ​share​-n-​earn​​ ​to​ ​promote​ ​itself.​ ​As individual​ ​bids​ ​on​ ​any​ ​given​ ​auction​ ​only​ ​cost​ ​10¢,​ ​micro-affiliates​ ​are​ ​offered​ ​a​ ​bigger​ ​incentive​ ​by​ ​earning the​ ​value​ ​of​ ​20%​ ​of​ ​all​ ​the​ ​bids​ ​made​ ​by​ ​a​ ​new​ ​customer​ ​for​ ​the​ ​first​ ​year.​ ​Unlike​ ​in​ ​the​ ​example​ ​above,​ ​this case​ ​requires​ ​that​ ​the​ ​micro-affiliate​ ​id​ ​is​ ​recorded​ ​against​ ​each​ ​new​ ​customer's​ ​account​ ​as​ ​they​ ​register.​ ​It also​ ​requires​ ​that​ ​the​ ​price​ ​attribute​ ​is​ ​constructed​ ​with​ ​the​ ​micro-affiliate's​ ​id​ ​for​ ​every​ ​sale​ ​to​ ​that​ ​customer during​ ​the​ ​first​ ​year.​ ​This​ ​case​ ​is​ ​further​ ​complicated​ ​by​ ​the​ ​fact​ ​that​ ​the​ ​application​ ​accepts​ ​two​ ​currencies (USD​ ​and​ ​a​ ​virtual​ ​currency​ ​called​ ​#BID),​ ​as​ ​we​ ​shall​ ​see. ​ ​ ​ ​ ​ ​ ​ ​ ​ ​6   

 

  share-n-earn​ ​Button The​ ​S-N-E​ ​ ​ ​button​ ​is​ ​always​ ​the​ ​same​ ​as​ ​it's​ ​intended​ ​to​ ​promote​ ​the​ ​whole​ ​site​ ​rather​ ​than​ ​a​ ​particular piece​ ​of​ ​content. data-cobrand="Carrot.org" data-link="http://www.carrot.org​ ​/carrotbid/share-n-earn.php">




data-scheme​​ ​points​ ​to​ ​a​ ​static​ ​html​ ​page​ ​which​ ​simply​ ​describes​ ​the​ ​affiliate​ ​scheme​ ​for​ ​the​ ​benefit of​ ​a​ ​potential​ ​affiliate.



data-earn​​ ​is​ ​an​ ​one-line​ ​summary​ ​of​ ​the​ ​scheme.



data-title​​ ​is​ ​the​ ​full​ ​name​ ​of​ ​the​ ​application.



data-cobrand​​ ​is​ ​the​ ​company​ ​domain.



data-link​ ​points​ ​to​ ​a​ ​PHP​ ​function​ ​which​ ​reads​ ​the​ ​micro-affiliate​ ​id​ ​from​ ​the​ ​URL​ ​and​ ​stores​ ​it​ ​in​ ​a non-persistent​ ​cookie.​ ​It​ ​then​ ​redirects​ ​the​ ​page​ ​to​ ​the​ ​CarrotBid​ ​application.​ ​It​ ​does​ ​it​ ​this​ ​way because​ ​Facebook​ ​manages​ ​the​ ​environment​ ​that​ ​the​ ​application​ ​runs​ ​in​ ​and​ ​the​ ​user's​ ​Facebook id​ ​is​ ​not​ ​available​ ​until​ ​obtained​ ​through​ ​the​ ​Facebook​ ​API.​ ​The​ ​full​ ​source​ ​code​ ​of​ ​this​ ​PHP function​ ​is​ ​shown​ ​in​ ​Appendix​ ​A.  

​ ​ ​ ​ ​ ​ ​ ​ ​ ​7   

 

Publishing​ ​the​ ​link

  When​ ​the​ ​micro-affiliate​ ​posts​ ​the​ ​link​ ​on​ ​Facebook​ ​they​ ​will​ ​be​ ​presented​ ​with​ ​the​ ​following​ ​page. They​ ​can​ ​enter​ ​some​ ​text​ ​to​ ​further​ ​encourage​ ​their​ ​friends​ ​to​ ​follow​ ​the​ ​link,​ ​and​ ​choose​ ​one​ ​of​ ​the​ ​images to​ ​display​ ​from​ ​the​ ​10​ ​available. This​ ​post​ ​will​ ​then​ ​be​ ​published​ ​by​ ​Facebook​ ​to​ ​the​ ​news​ ​feeds​ ​of​ ​the​ ​micro-affiliate's​ ​friends.

Accessing​ ​the​ ​link​ ​from​ ​a​ ​news​ ​feed

The​ ​published​ ​news​ ​feed​ ​item​ ​is​ ​much​ ​like​ ​any​ ​other​ ​and​ ​is​ ​intended​ ​to​ ​take​ ​the​ ​user​ ​directly​ ​to​ ​the CarrotBid​ ​application.

However,​ ​if​ ​this​ ​is​ ​the​ ​first​ ​time​ ​for​ ​a​ ​user​ ​to​ ​access​ ​the​ ​CarrotBid​ ​application,​ ​Facebook​ ​requires​ ​them​ ​to grant​ ​permission​ ​for​ ​CarrotBid​ ​to​ ​access​ ​their​ ​personal​ ​data,​ ​otherwise​ ​they​ ​are​ ​taken​ ​directly​ ​to​ ​the application. When​ ​a​ ​new​ ​user​ ​to​ ​CarrotBid​ ​clicks​ ​the​ ​image​ ​or​ ​the​ ​title​ ​of​ ​the​ ​post,​ ​they​ ​are​ ​taken​ ​first​ ​to​ ​an​ ​authorisation page​ ​(as​ ​above),​ ​and​ ​then​ ​to​ ​the​ ​home​ ​page​ ​of​ ​the​ ​CarrotBid​ ​application (via​ ​share-n-earn.php).

​ ​ ​ ​ ​ ​ ​ ​ ​ ​8   

 

The​ ​CarrotBid​ ​application​ ​determines​ ​if​ ​this​ ​is​ ​a​ ​new​ ​user​ ​and​ ​if​ ​so​ ​it​ ​checks​ ​for​ ​the​ ​presence​ ​of​ ​a​ ​'referrer' cookie​ ​(as​ ​stored​ ​by​ ​share-n-earn.php).​ ​If​ ​set​ ​the​ ​referrer​ ​indicates​ ​the​ ​id​ ​of​ ​the​ ​micro-affiliate​ ​and​ ​this​ ​is stored​ ​in​ ​a​ ​newly​ ​created​ ​user​ ​record​ ​together​ ​with​ ​the​ ​global​ ​settings​ ​for​ ​the​ ​agreed​ ​micro-affiliate​ ​split percentage​ ​and​ ​the​ ​expiry​ ​data​ ​of​ ​the​ ​agreement​ ​(currently​ ​set​ ​at​ ​15%​ ​and​ ​365​ ​days). NOTE: By storing these values in the user record the global values may be updated from time to time without​ ​affecting​ ​already​ ​established​ ​micro-affiliate​ ​agreements.

User​ ​purchases  

The​ ​final​ ​piece​ ​of​ ​the​ ​puzzle​ ​is​ ​to​ ​calculate​ ​the​ ​price​ ​attribute​ ​when​ ​a​ ​user​ ​makes​ ​a​ ​bid​ ​(see​ A ​ ppendix​ ​B  for​ ​full​ ​source​ ​code).​ ​The​ ​principal​ ​is​ ​simple​ ​enough;​ ​split​ ​the​ ​original​ ​price​ ​into​ ​two​ ​parts​ ​and​ ​add​ ​an  affiliate​ ​id​ ​to​ ​the​ ​affiliate​ ​part.​ ​In​ ​this​ ​case​ ​we​ ​have​ ​the​ ​further​ ​complication​ ​that​ ​CarrotBid​ ​accepts​ ​#BID  tokens​ ​as​ ​well​ ​as​ ​USD.  The​ ​none-affiliate​ ​price​ ​is:    1.0:#BID;0.1:USD 

  This​ ​indicates​ ​that​ ​an​ ​acceptable​ ​payment​ ​to​ ​register​ ​a​ ​bid​ ​is​ ​#BID1.0​ ​OR​ ​USD0.10.​ ​When​ ​we​ ​add​ ​the  affiliate​ ​id​ ​we​ ​get:    0.8:#BID+0.2:#BID:BMWM-VJQB-LVJC-HKQW;0.08:USD+0.02:USD:BMWM-VJQB-LVJC-HKQW 

  NOTE:  An  implication  of  the  above  is  that  the  affiliate  may  receive  #BID  tokens  as  payment  as  well  as  USD.  In this case any #BID tokens can only be spent on CarrotBid auctions whereas the USD may be spent  ​ ​ ​ ​ ​ ​ ​ ​ ​ ​9   

 

anywhere.  NOTE:  Since  the  introduction  of  SiteCoins,  there  is  also  a  need  to  add  a  price_sig  parameter  to  each  payment​ ​request.​ ​See​ ​….   

Appendix​ ​A​ ​–​ ​A​ ​PHP​ ​generated​ ​page​ ​that​ ​processes​ ​an​ ​affiliate URL ​ < ​ ?php /* share-n-earn​ ​redirection​ ​page Filename:​ ​share-n-earn.php Authors:​ ​Jason​ ​2010-12-22 The​ ​purpose​ ​of​ ​this​ ​function​ ​is​ ​three​ ​fold: 1)​ ​To​ ​transfer​ ​the​ ​affiliate​ ​id​ ​to​ ​a​ ​cookie. 2)​ ​To​ ​pass​ ​a​ ​title,​ ​description​ ​and​ ​image​ ​selection​ ​to​ ​Facebook/other 3)​ ​To​ ​redirect​ ​to​ ​a​ ​specific​ ​auction​ ​if​ ​indicated​ ​by​ ​an​ ​auctionID​ ​parameter At​ ​the​ ​time​ ​when​ ​the​ ​link​ ​is​ ​about​ ​to​ ​be​ ​posted,​ ​Facebook/other​ ​may​ ​pick​ ​up some​ ​meta​ ​data​ ​from​ ​the​ ​header.​ ​However​ ​in​ ​test​ ​we​ ​found​ ​that​ ​Facebook​ ​more reliably picked​ ​up​ ​first​ ​

​ ​and​ ​​ ​elements​ ​from​ ​the​ ​body.

*/

This​ d ​ ata​ ​is​ ​apparently​ ​aggressively​ ​cached​ ​by​ ​Facebook​ ​so​ ​we​ ​cannot​ ​readily​ ​change​ ​it from​ i ​ nstance​ ​to​ ​instance.

include​ ​'globalVariables.php'; include​ ​'utils.php'; $referrer=$_GET["aff"]; $auctionID=$_GET["auctionID"]; ​ ​ ​ ​/*

Store​ ​the​ ​referrer​ ​and​ a ​ uctionID​ ​in​ ​the​ u ​ ser's​ ​cookie​ ​so​ ​that​ ​it​ ​can​ b ​ e​ ​found​ i ​ f​ ​a​ ​new user​ ​record​ ​is​ ​created​ C ​ ookie​ ​expiry​ ​is​ q ​ uite​ ​short​ ​in​ ​case​ ​the​ ​user​ d ​ oes​ ​not​ c ​ omplete

*/ setCookie("referrer",$referrer,time()+300); setCookie("gotoauction",$auctionID,time()+60); /*

*/

Apparently​ ​Facebook​ ​will​ ​not​ ​pick​ ​up​ ​the​ ​meta-data​ ​from​ ​this​ ​page​ ​if​ ​we​ ​redirect​ ​with​ ​a header​ ​Location​ ​line​ ​like​ ​this​ ​-​ ​header('Location:​ ​'.$facebookHome); Instead​ ​we​ ​use​ ​Javascript​ ​to​ ​redirect​ ​once​ ​the​ ​page​ ​loads.​ ​In​ ​order​ ​to​ ​hide​ ​the​ ​images on​ ​the​ ​page​ ​we​ ​use​ ​css​ ​to​ ​hide​ ​them.

?> CarrotBid:​ ​Lowest​ ​Unique​ ​Bid​ ​Auctions



NOTE:​​ ​Due​ ​to​ ​Facebook​ ​aggressively​ ​caching​ ​share​ ​links,​ ​it​ ​may​ ​be​ ​difficult​ ​to​ ​get​ ​Facebook​ ​to​ ​offer​ ​the ​ ​ ​ ​ ​ ​ ​ ​ ​ ​10   

 

correct​ ​description​ ​and​ ​image.​ ​Some​ ​experimentation​ ​may​ ​be​ ​needed.

Appendix​ ​B​ ​–​ ​A​ ​function​ ​to​ ​calculate​ ​the​ ​price​ ​attribute /* *​ ​This​ ​function​ ​is​ ​used​ ​to​ ​calculate​ ​an​ ​affiliate​ ​price​ ​for​ ​share-n-earn *​ ​@input​ ​price:​ ​original​ ​price *​ ​@input​ ​userID:​ ​a​ ​reference​ ​for​ ​a​ ​user​ ​in​ ​the​ ​database *​ ​The​ ​user's​ ​record​ ​contains​ ​the​ ​affiliate's​ ​id,​ ​the​ ​percentage​ ​of​ ​the​ ​split *​ ​and​ ​the​ ​expiry​ ​date​ ​of​ ​the​ ​agreement. *​ ​@return​ ​share-n-earn​ ​price​ ​as​ ​a​ ​string *​ ​The​ ​database​ ​connection​ ​must​ ​be​ ​available. */ function​ ​se_price($price,​ ​$userID)​ ​{ ​ ​//​ ​Get​ ​the​ ​share-n-earn​ ​information​ ​from​ ​DB $searchQuery​ ​=​ ​"select​ ​affiliate,​ ​split​ ​from​ ​user​ ​where​ ​userID='$userID'​ ​and referrerExpiry>now()"; ​ ​$result​ ​=​ ​mysql_query($searchQuery); ​ ​if(mysql_num_rows($result)>0)​ ​{ ​ ​$se​ ​=​ ​mysql_fetch_assoc($result); ​ ​if(isset($se))​ ​{ $priceArray​ ​=​ ​explode(";",$price); foreach($priceArray​ ​as​ ​$key​ ​=>​ ​$value)​ ​{ ​ ​$priceValueArray​ ​=​ ​explode(":",​ ​$value); ​ ​$tmp​ ​=​ ​sprintf("%0.3f",​ ​($se["split"]​ ​*​ ​floatval($priceValueArray[0]))); ​ ​$priceParts[$key]​ ​=​ ​sprintf("%0.3f:%s+%s:%s:%s", (floatval($priceValueArray[0])​ ​–​ ​floatval($tmp)), $priceValueArray[1],​ ​$tmp,​ ​$priceValueArray[1], $se['affiliate']); ​ ​} ​ ​return​ ​implode(";",​ ​$priceParts); }​ ​else​ ​echo​ ​"No​ ​affiliate​ ​data​ ​found"; } ​ ​return​ ​$price; }

​ ​ ​ ​ ​ ​ ​ ​ ​ ​11   

 

share n earn

share​-n-​earn​ (S-N-E), is a free micro-affiliate network service for web sites ... 3. Merchant determines the terms of the revenue split. 4. Merchant need not ...

583KB Sizes 1 Downloads 175 Views

Recommend Documents

No documents