Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • suzyb 474 posts 932 karma points
    Mar 18, 2012 @ 21:26
    suzyb
    0

    Add custom querystring to links in ProcessUniqItem

    I'd like to insert a custom unsubscribe and edit profile link in my newsletter.  So I have overridden ProcessUniqItem in which I get the subscriber ID from our custom table using the email address and replace a couple of placeholders with the querystring part of the appropriate URL.  It doesn't seem to be replacing the placeholder however.

    My placeholders are like this, links selected using the insert anchor popup with the placeholder added to the end of the URL.

    <a href="/aboutour-pragency/prnews/news-registration.aspx[EDIT_LINK]" title="News Registration">edit your profile</a>

    ProcessUniqItem should then replace [EDIT_LINK] a querystring containing the ID of the subscriber.  But it doesn't seem to be.

    I noticed tracking is added to links, could this be preventing my code from replacing the text.

  • Markus Johansson 1930 posts 5858 karma points MVP 2x c-trib
    Mar 19, 2012 @ 06:25
    Markus Johansson
    0

    Hi!

    All rendertasks happens in the order they are sorted inside web.config, It would be best to add this custom task before adding the clicktracking. If that's not possible you have to match on the url-converted values.

    Like this:

    html = html.Replace(HttpUtility.UrlEncode("[email]"), HttpUtility.UrlEncode(emailTrackingItem.Email));


    Its a good idea to set a breakpoint in the code and hook in to the webserver process, that way you can debug your rendertask to maske sure that everything works as expected.

    Another thing to concider is the fact that this will perform and database call for each email which may slow down the send out process, make sure to really clean up all resources used by you custom render task.

  • suzyb 474 posts 932 karma points
    Mar 19, 2012 @ 10:50
    suzyb
    0

    Url encoding and moving the render task worked.  Thanks.

    I'm also going to look for another solution to hitting the database every email.  Right now I'm just trying to get it working and since we only have around 20 subscribers that will do for now.

  • Markus Johansson 1930 posts 5858 karma points MVP 2x c-trib
    Mar 19, 2012 @ 12:17
    Markus Johansson
    0

    Great! Theres no need to avoid it, just want to make you avare of the fact! =D

    Nice to hear that you are using the render tasks! =D

  • suzyb 474 posts 932 karma points
    Mar 22, 2012 @ 14:44
    suzyb
    0

    One more little query.  Is there a way to stop the tracking starting with a ?.

    The tracking is appended onto my URL but as I've added a querystring there is already a ? in it.

  • Markus Johansson 1930 posts 5858 karma points MVP 2x c-trib
    Mar 29, 2012 @ 07:07
    Markus Johansson
    0

    Hi!

    All render tasks are listed in the web.config-file "/umbraco/newsletterstudio/web.config". I quess you could comment out the task for the tracking, then Newsletter Studio want run that task. Please be careful when playing aroud, take a backup of you web.config before you start..

    // M

Please Sign in or register to post replies

Write your reply to:

Draft