preload

Pimp Your Prosper with Subid Injection Buttons

Posted by ctrtard on Aug 13, 2010

I love Prosper 202, but the GUI needs help. I mean copying and pasting [[subid]]? Really?!?

We may as well all just bust out Mosaic and get it over with.

Embrace the 21st Century

Mod Features

  • Larger Campaign Name field. (More room to edit!)
  • Larger Affiliate URL field. (The better to see those big-ass tracking links.)
  • Some Sweet Subid Injection Buttons. No more copy/paste means less room for error and way less 1994.

 

Doing the Mod

EDIT FILE: tracking202/setup/aff_campaigns.php

Note: these specific line numbers refer to Prosper 1.5.1 stable release. If you have a newer version, the mod should work fine, just be sure to double-check where you’re inserting the code.

Change 1/3

Line 209: Comment out the existing input field, then paste the new line directly below it as shown.

209
210
<!-- <input type="text" name="aff_campaign_name" value="<? echo $html['aff_campaign_name']; ?>" style="display: inline;"/> -->
<textarea name="aff_campaign_name" rows="1" cols="30" style="display: inline;"/><? echo $html['aff_campaign_name']; ?></textarea>

Change 2/3

Line 243: Again, comment out the existing input field, then paste the new code as shown.

243
244
245
246
247
248
249
250
251
252
253
254
<!-- <input type="text" name="aff_campaign_url" value="<? echo $html['aff_campaign_url']; ?>" style="width: 200px; display: inline;"/> -->
<textarea name="aff_campaign_url" rows="3" cols="30" id="aff_campaign_url" style="width: 260px; display: inline;"/><? echo $html['aff_campaign_url']; ?></textarea>
<div>
    <!-- Part of CtrTard's Subid Injection Button Mod, 8-12-2010, http://ctrtard.com --> 
    <input type="button" value="[[subid]]" onclick="insertAtCaret('aff_campaign_url','[[subid]]');" />
    <input type="button" value="[[c1]]" onclick="insertAtCaret('aff_campaign_url','[[c1]]');" /> 
    <input type="button" value="[[c2]]" onclick="insertAtCaret('aff_campaign_url','[[c2]]');" /> 
    <input type="button" value="[[c3]]" onclick="insertAtCaret('aff_campaign_url','[[c3]]');" /> 
    <input type="button" value="[[c4]]" onclick="insertAtCaret('aff_campaign_url','[[c4]]');" />
    <br>  
    The following tracking placeholders can be used:<br/>
    [[subid]], [[c1]], [[c2]], [[c3]], [[c4]]

Change 3/3

Line 351: Between </table> and <? template_bottom(); paste this block of code as shown.

350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
</table>
 
<script>
// Part of CtrTard's Subid Injection Button Mod
// 8-12-2010 http://ctrtard.com 
// Function from: http://www.scottklarr.com/topic/425/how-to-insert-text-into-a-textarea-where-the-cursor-is/
// As is, this code didn't work with stupid IE. So caret function has been added, and code adjusted. Works on IE8!
function insertAtCaret(areaId, text) {
    var txtarea = document.getElementById(areaId);
    var scrollPos = txtarea.scrollTop;
    var strPos = 0;
    var br = ((txtarea.selectionStart || txtarea.selectionStart == '0') ? "ff" : (document.selection ? "ie" : false));
    txtarea.focus();
    strPos = caret(txtarea);
    var front = (txtarea.value).substring(0, strPos);
    var back = (txtarea.value).substring(strPos, txtarea.value.length);
    txtarea.value = front + text + back;
    strPos = strPos + text.length;
    if (br == "ie") {
        txtarea.focus();
        var range = document.selection.createRange();
        range.moveStart('character', -txtarea.value.length);
        range.moveStart('character', strPos);
        range.moveEnd('character', 0);
        range.select();
    } else {
        txtarea.selectionStart = strPos;
        txtarea.selectionEnd = strPos;
        txtarea.focus();
    }
    txtarea.scrollTop = scrollPos;
}
//Function from: http://web.archive.org/web/20080214051356/http://www.csie.ntu.edu.tw/~b88039/html/jslib/caret.html
// Thank you sir, you're a damn genius!  This solution works great on IE8!
function caret(node) {
 //node.focus(); 
 /* without node.focus() IE will returns -1 when focus is not on node */
 if(node.selectionStart) return node.selectionStart;
 else if(!document.selection) return 0;
 var c        = "\001";
 var sel    = document.selection.createRange();
 var dul    = sel.duplicate();
 var len    = 0;
 dul.moveToElementText(node);
 sel.text    = c;
 len        = (dul.text.indexOf(c));
 sel.moveStart('character',-1);
 sel.text    = "";
 return len;
}
</script>
 
<? template_bottom();

Final Thoughts

At first, this mod took me about 10 minutes to do. It worked just fine in Firefox, and I felt really smart… until I tested it in IE8. Piece of shit! It turns out, Firefox, Safari, and Opera all support some simple JavaScript ‘selectionStart’ calls. But stupid Internet Explorer does not. The solution I came up with is cobbled together from two different scripts I found. For those interested, I’ve added comments in the code so you can find the original sources.

And now, I’d like to ask a favor of my blog readers… If you’ve found this or any of the other mods/scripts/posts on my blog useful, a great way to say thanks would be to help me out with a fundraising campaign I’m working on for the The Leukemia & Lymphoma Society’s (LLS). This is fully tax deductible (info is on the page) and it’s for a great cause. If you do make a donation, please let me know so I can give you a proper thank you.

And finally….

Do you have any ideas for a Prosper202 mod you’d like to see? Post it in the comments below. If it sounds good and feasible, I’ll probably do it!

0saves
If you enjoyed this post, it's easy to thank me! Share it using a button on the left, leave a comment or subscribe to my RSS feed. Thanks!

Related posts:

  1. Passing Variables Through Prosper 202 Mod
  2. Custom Start Page for Prosper 202 Mod
  3. Split Testing and Rotating Offers in Tracking202
  4. Split Testing and Landing Page Rotation Script for PPV
  5. Prosper 202 1.7 Release and Chart disable Mod

Tags: , ,
  • 20 responses to "Pimp Your Prosper with Subid Injection Buttons"

  • browie
    August 14, 2010 6:56 AM 

    Cool stuff man.

  • Juntao
    August 14, 2010 7:16 AM 

    Possibly a mod where you can inject a user-added subid via a lander and pass it through to the affiliate url? Like for pre-pop email scripts. I tried it before and it just was such a headache. But I’m no coder.

  • BC
    August 14, 2010 4:08 PM 

    I’ve tried this but my #3 Aff Campaign page now shows the text “The following tracking placeholders can be used:[[subid]], [[c1]], [[c2]], [[c3]], [[c4]] ” twice underneath the buttons.

    Have a look here, http://img338.imageshack.us/img338/3876/sudid.png

    Also, in step 3 I first accidently pasted the & <? template_bottom(); code into the file, so I got an error for that. Maybe it might be better to leave them out of step 3 as it confused me for a sec.

    This is a great idea, thx for this. I've been doing some basic tweaking myself. :)

    • ctrtard
      August 16, 2010 8:46 AM 

      Hi,

      You’re showing “[[subid]]…” twice because you have the line two times in your source file. (Same issue as the other you wrote about.)

      I include existing lines in my changes to make the places to edit easier to find. Hopefully other people aren’t being confused by this too.

  • David
    August 15, 2010 10:34 PM 
    • BC
      August 16, 2010 11:55 AM 

      Found the problem, yeah, you’re right, it was in there twice. I didn’t see it, as I had word-wrap off. :)

      Thanks, ctrtard, works great now.

  • James Seligman
    August 19, 2010 12:19 AM 

    Great stuff! Worked perfectly, Thanks

  • Riley
    September 04, 2010 4:48 PM 

    Good stuff here man. This is especially useful for people like me who continually forget to add the [[subid]] variable to the end of my tracking links.

  • puddingmode
    November 07, 2010 9:14 PM 

    You should be able to get rid of the selectionStart errors in IE8 by specifying your !DOCTYPE

    • ctrtard
      November 08, 2010 2:25 PM 

      Interesting, thanks for the tip. I’m not really a JavaScript guy. I’ll have to try that.

      Thanks for reading & commenting!

  • Joseph
    November 24, 2010 12:02 AM 

    I hope you’re monotizing the *HELL* out of this content! (Every post I read by you is amazing.) Anyway, if you’re not, I know a *really* good marketer… *wink*

  • Joe
    November 24, 2010 6:50 AM 

    Works Great! So simple to add too.

    Thanks

  • Scott
    December 08, 2010 12:07 PM 

    I love the mod .. & it was badly needed. I hated having to C&P the [[subid]] if I was creating alot of campaigns.

    Idea: .. What about a script that automatically inserts the [[subid]] at the end of the aff link, saving a step. Then using the buttons for the additional [[c]] variables?

    Another Idea I would love to have… being able to mass create tracking by importing via csv. For example, say you have 50 tracking links for TV & want to scale to other PPV networks. If you are just scaling to 2 other networks you would have to create 100 new links just to track the traffic source. Just a thought :)

    I think I can figure a way to do it with excel & phpmyadmin .. but would love to have in the interface.

    Thanks again for the Mod!

    • ctrtard
      December 10, 2010 7:29 PM 

      Auto inserting [[subid]] would be great except that not all networks have the subid at the end of the URL. So that would just lead to confusion/problems.

      The other idea you have sounds interesting and wouldn’t be too hard. I’ll give it some thought.

      Thanks for reading & commenting!

  • Chris
    April 09, 2011 10:55 AM 

    Great share, the affiliate marketing community salutes you!

    Cheers,

    -Chris

  • Leave a Comment

    * Required
    ** Your Email is never shared
    *

    CommentLuv badge