Pimp Your Prosper with Subid Injection Buttons

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!

Leave a comment

Leave a Reply to ctrtard Cancel reply.

*

*

CommentLuv badge
Cancel reply

22 Comments

  • Cool stuff man.

    • Glad you like it. Thanks for reading!

  • Juntao

    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.

  • 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. πŸ™‚

    • 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.

  • Very nice πŸ™‚

    • 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.

  • Great stuff! Worked perfectly, Thanks

  • 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.

    • Glad you dig it. Thanks for reading and commenting!

  • puddingmode

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

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

      Thanks for reading & commenting!

  • 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*

    • Thanks man! πŸ˜‰

  • Works Great! So simple to add too.

    Thanks

  • Scott

    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!

    • 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

    Great share, the affiliate marketing community salutes you!

    Cheers,

    -Chris

    • Thank you sir! And thanks for reading πŸ˜‰

Trackbacks/Pingbacks

[…] Thanks Wes Brooks for reminding more of this cool mod that makes it easier to use the new tokens: http://ctrtard.com/affiliate-marketing/pimp-your-prosper-with-subid-injection-buttons/ […]

Pimp Your Prosper with Subid Injection Buttons [Link] « October 18, 2010

[…] mod by yours truly also made it into this new release! My Subid Injection Buttons mod is now officially part of Prosper 202. […]

Pimp Your Prosper with Subid Injection Buttons [Link] « October 18, 2011

 
 
 

Related posts by category

Related posts by tag