TMC is an independent, primarily volunteer organization that relies on ad revenue to cover its operating costs. Please consider whitelisting TMC on your ad blocker or making a Paypal contribution here: paypal.me/SupportTMC

Randomized Referral!

Discussion in 'Tesla Motors' started by K-MTG, Feb 22, 2016.

  1. K-MTG

    K-MTG Sunshade Captain of TMC

    Joined:
    Oct 24, 2015
    Messages:
    2,391
    Location:
    Irvine, CA

    I created a simple webpage where Tesla owners can input their referral link. The inputted referral link automatically randomizes each time the page is loaded so prospected buyers have a link to choose from.

    Tesla Owners: Feel free to add your referral link to the randomizes list.

    Prospected Buyers: It must be hard to choose a referral link as they are so many helpful members on TMC, you may use this site to obtain a randomized referral link.


    I appreciate any feedback
     
    • Like x 8
  2. FlatSix911

    FlatSix911 918 Hybrid

    Joined:
    Jun 15, 2015
    Messages:
    2,350
    Location:
    Silicon Valley
    Great idea ... thanks.
     
  3. K-MTG

    K-MTG Sunshade Captain of TMC

    Joined:
    Oct 24, 2015
    Messages:
    2,391
    Location:
    Irvine, CA
    #3 K-MTG, Feb 22, 2016
    Last edited: Feb 22, 2016
    Thanks, glad you liked it! Please let me know if I can make any improvements.

    I am no pro at web-design so I would appreciate it any tips.
     
  4. FlatSix911

    FlatSix911 918 Hybrid

    Joined:
    Jun 15, 2015
    Messages:
    2,350
    Location:
    Silicon Valley
    #4 FlatSix911, Feb 22, 2016
    Last edited: Feb 22, 2016
    It would be great to know how many referral requests are provided to buyers. Thanks
     
  5. K-MTG

    K-MTG Sunshade Captain of TMC

    Joined:
    Oct 24, 2015
    Messages:
    2,391
    Location:
    Irvine, CA
    Can you please explain, I don't understand.
     
  6. FlatSix911

    FlatSix911 918 Hybrid

    Joined:
    Jun 15, 2015
    Messages:
    2,350
    Location:
    Silicon Valley
    Sorry about the typo ... I corrected the original question. I'm Just looking for the number of referrals that are requested by buyers
     
  7. K-MTG

    K-MTG Sunshade Captain of TMC

    Joined:
    Oct 24, 2015
    Messages:
    2,391
    Location:
    Irvine, CA
    Good idea, I will search for a solution that lets me do that.

    Anyone familiar with HTML/PHP?
    As you can see, I created a PHP script that picks a random line from a .txt file on the server. So whenever anyone loads the page they will get a random referral URL that is posted on the .txt file.
    I also have a input forum embedded on the page from Wufoo that emails me the link whenever anyone submits their referral URL. So I have to manually copy and paste the referral URL onto the .txt file on my server. Anyone know of a faster solution, that will automatically post the URL from the forum to the .txt file?

    Thanks
     
  8. Branzo90D

    Branzo90D Salt and Pepper

    Joined:
    Oct 13, 2015
    Messages:
    105
    Location:
    NorCal
    Don't know anything about HTML/PHP, but I appreciate the chance to get some referrals. :smile:

    Thanks!
     
  9. Jason S

    Jason S Model S Sig Perf (P85)

    Joined:
    Apr 20, 2012
    Messages:
    1,350
    Location:
    Rocklin, CA
    I'd write back to the .txt file using a delimiter to tag on the number of referrals. That way you only need to be familiar with file IO and you get to learn about string manipulation.

    Be sure to test thoroughly before deployment!
     
  10. K-MTG

    K-MTG Sunshade Captain of TMC

    Joined:
    Oct 24, 2015
    Messages:
    2,391
    Location:
    Irvine, CA
    You lost me :confused:... I will take a look at it and do some research.
    But I am debating if I should make it automatic (based on your instructions) or leave it alone since I currently get to moderate the links people submit to make sure nobody spams the input forum with links forwarding to other sites.
    However if you have time, I can PM the php file to you it is a very simple site with only one page.
     
  11. Jason S

    Jason S Model S Sig Perf (P85)

    Joined:
    Apr 20, 2012
    Messages:
    1,350
    Location:
    Rocklin, CA
    #11 Jason S, Feb 22, 2016
    Last edited: Feb 22, 2016
    I haven't coded PHP in years! And even then I was just hacking somebody else's code.

    Here's the overview of what I'm suggesting:

    You have a .txt file filled with URLs like so (I put a space after the first w so the forum wouldn't auto url these):
    w ww.myplace.net
    w ww.myotherplace.net
    w ww.myplace.net/foo/bar

    And you want to track how many referrals each gets. Right now you are choosing a random line in the file. So just write back to the file with the number after a special character (or two or w/e). Like so:

    w ww.myplace.net|1
    w ww.myotherplace.net|3
    w ww.myplace.net/foo/bar|2

    So your code would operate like this:
    1) choose a random line
    2a) if delimiter in the line, spit out everything before the delimiter (|), increment the number after the delimiter
    2b) (else) since no delimiter just spit out the line and attach |1 at the end of the line.
    3) write back the file

    Really quick, really simple. And you just keep adding lines to the file manually whenever you want. Just remember to shut down the web page whenever you update the file with your additions (stop page, add lines via copy/paste, start page).
     
  12. K-MTG

    K-MTG Sunshade Captain of TMC

    Joined:
    Oct 24, 2015
    Messages:
    2,391
    Location:
    Irvine, CA
    Yup, that is what I have.

    I should have mentioned this before, this is my first time coding in PHP. Let me show you what I have now (I took out the stuff that doesn't matter):
    Code:
    <?php
    $text = file_get_contents('Data.txt');
    $textArray = explode("\n", $text);
    $randArrayIndexNum = array_rand($textArray);
    $randPhrase = $textArray[$randArrayIndexNum];
    ?>
    <html>
    <body>
    
    
    <center>
    <h1>
    <a href="<?php echo $randPhrase; ?>">YOUR RANDOM  REFERRAL LINK</a>
    </center>
    </h1>
    
    
    </body>
    </html>
    
    If I add values after the domain of the referral link won't it prevent the page from hyperlinking properly?
     
  13. Rifleman

    Rifleman Now owns 2 Model S's!!!

    Joined:
    Nov 29, 2011
    Messages:
    936
    Location:
    Harrison Ohio
    Very cool idea, I like it!
     
  14. HankLloydRight

    HankLloydRight Fluxing

    Joined:
    Jan 18, 2014
    Messages:
    5,787
    Location:
    Connecticut
    Great idea for the randomizer, but I don't think tracking the number of referrals is possible. What you're tracking is either the number of times any particular referral link is displayed (increments one with each new page load), or with a little more code, the number of times a referral link is clicked. Neither of those will really reflect the actual number of referrals.

    I would like to see the total number of referral links currently being chosen from, though.

    - - - Updated - - -


    Also, I know it's a manual process now, but I'd add code to make sure that any submitted referral link is a real Tesla referral link, and not a link to someone's Tesla Referral webpage or custom domain.

    - - - Updated - - -

    You would need to break out the counters, like this:

    PHP:
    $randPhrase explode('|',$textArray[$randArrayIndexNum]);
    $url=$randPhrase[0];
    $counter=$randPhrase[1];

    Code:
    <a href="<?php echo $url; ?>">YOUR RANDOM  REFERRAL LINK</a> Counter: <? echo $counter; ?>
     
  15. murphyS85

    murphyS85 Member

    Joined:
    Oct 12, 2014
    Messages:
    70
    Location:
    Horsham, PA
    If someone's link gets used three times there needs to be a way to get it removed from the list because after three it is no longer a valid link.
    Unfortunately having it copied three times does not mean it has actually been used three times. Only the link owner will have that information.
     
  16. McHoffa

    McHoffa Member

    Joined:
    Sep 29, 2015
    Messages:
    589
    Location:
    Canton, NC
    sent you a PM about design files for it
     
  17. K-MTG

    K-MTG Sunshade Captain of TMC

    Joined:
    Oct 24, 2015
    Messages:
    2,391
    Location:
    Irvine, CA
    Thanks for the information, I will do some testing and deploy the updated site this evening.
     
  18. Kbra

    Kbra Member

    Joined:
    Feb 4, 2015
    Messages:
    220
    Location:
    California
    Im up for the dice roll.
     
  19. Reeler

    Reeler 6 Years of Pure EV

    Joined:
    Oct 14, 2015
    Messages:
    647
    That is a great idea. Maybe allow the folks providing their link the ability to opt out once they receive 3 to let others have a chance.

    - - - Updated - - -

    Has anyone received a referral yet in the new program? Will there be a counter like before at MyTesla?
     
  20. HankLloydRight

    HankLloydRight Fluxing

    Joined:
    Jan 18, 2014
    Messages:
    5,787
    Location:
    Connecticut
    Yes, I've received one credit so far (and I believe one more pending confirmation), and the MyTesla page updates with the counter. I don't know what happens after 3 referrals, if it will indicate that there are no more available.

    What happens to a buyer who uses someone's referral link who is maxed out? I suspect they still get the $1200 credit, but the referrer gets maxed out at 3. It would suck of the buyer gets a message "referrer link bad, please try another".
     

Share This Page