Support » Plugin: Pretty Links - Link Management, Branding, Tracking & Sharing Plugin » Forwarding URL Parameters without appending them to starting URL?

  • Resolved spark36

    (@spark36)


    I’m using the parameter forwarding feature and have successfully been able to append parameters to a prettylink and have them forwarded to the destination URL. However, this means that the link showing on my site still has a bunch of ugly parameters in it.

    Is there anyway to append the parameters after a user clicks the prettylink? Something that would add them on during the redirect itself, or using an OnClick event or something? This would look a lot cleaner if my prettylink didn’t end up looking so messy with all the tracking parameters.

    BTW – I am using dynamic parameters that are set based on the user who is currently logged into my site.

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author cartpauj

    (@cartpauj)

    There is a filter hook on the target URL which you can use if you’re familiar with WordPress filter hooks and creating your own callback.

    The filter hook is located here: https://plugins.trac.wordpress.org/browser/pretty-link/tags/2.1.2/app/models/PrliUtils.php#L256

    Thread Starter spark36

    (@spark36)

    Thanks for pointing that out cartpauj. Good to know this is possible. I understand the concept of these hooks and can understand PHP at a very basic level but I’m not experienced enough to do this myself from scratch.

    Any chance you could point me in the right direction for how to use this hook to pass my dynamic parameters to the URL? I’m happy to purchase the plugin if I can accomplish what I’m looking to do with it.

    The dynamic parameters are currently added to prettylinks using shortcodes from my membership plugin. Is it possible to use the filter hook to dynamically append these parameters to the destination URL using these shortcodes?

    Thanks.

    • This reply was modified 4 years, 9 months ago by spark36.
    Plugin Author cartpauj

    (@cartpauj)

    This code could be pasted into your theme’s functions.php file – or in a plugin like My Custom Functions.

    function append_to_target_url($link_data) {
      $some_param_string_here = ''; //Do your parameter calculations here based on the current user
      $link_data['url'] = $link_data['url'] . $some_param_string_here;
      return $link_data;
    }
    add_filter('prli_target_url', 'append_to_target_url');
    • This reply was modified 4 years, 9 months ago by cartpauj. Reason: forgot filter name
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Forwarding URL Parameters without appending them to starting URL?’ is closed to new replies.