You are here:  » Set up Jump link


Set up Jump link

Submitted by PS on Mon, 2018-06-18 20:04 in

Hi, sorry another one from me.

How do I setup link 'cloaking' with a jump script or similar?

So for instance, I'd like the affiliate link to look like:

domain.com/go/merchantname/ (or similar)

Thanks for any help! :)

Tim

Submitted by support on Tue, 2018-06-19 11:20

Hi Tim,

That's all built-in, from wp-admin > Settings > PriceTapestry.org make sure that the drop-down next to $config_useTracking (under the External section) is set to TRUE. Exit links then go via jump.php (and also increment the clicks count displayed on the /pt/admin/ home page assuming that $config_useTracking is also set to TRUE in /pt/config.php)...

Cheers,
David.
--
PriceTapestry.com

Submitted by PS on Tue, 2018-06-19 15:45

Aaah, okay great. I remember now.

Is there a way to re-write/make the link out, 'pretty'? E.g. /out/merchant/

Submitted by support on Wed, 2018-06-20 07:18

Hi,

Sure, for /out/Merchant-Name/ID/ edit your WordPress .htaccess and look for the RewriteBase line:

RewriteBase /

...and REPLACE with:

RewriteBase /
RewriteRule ^out/(.*)/(.*)/$ pt/jump.php?id=$2 [L]

Then edit the plugin file pto_common.php and look for the following code at line 105:

    return $pto_config_externalBaseHREF."jump.php?id=".$product->id;

...and REPLACE with:

    return "/out/".pto_common_hyphenate($product->merchant)."/".$product->id."/";

(assuming Price Tapestry installed in /pt/ sub-directory as per the quick start guides)

You might also want to add an excludsion for /out/ to your top level robots.txt...

Cheers,
David.
--
PriceTapestry.com

Submitted by PS on Wed, 2018-06-20 21:27

Perfect, thanks so much, David.

Only thing I do notice is that the jump redirect time seems a little slow but I guess there's not much one can do about this?

Submitted by support on Thu, 2018-06-21 08:40

Hi,

The rewrite certainly shouldn't have any impact; redirection is certainly as fast as it can be - I think in some cases it can appear to be slow if the browser status or address bar still showing the tracking link when in fact the connection to the next hop (normally the affiliate network for the merchant) is being made in the background...

Cheers,
David.
--
PriceTapestry.com

Submitted by PS on Sat, 2018-06-23 23:12

Thanks, David, didn't realise that.

There is an issue with the re-written link, in that when there are merchants with spaces in their name - e.g. "Best Buy", it fails to redirect as it's converted to HTML - i.e. %20. Is the best thing to just make it one word such as 'BestBuy' or is there a simple fix?

Submitted by PS on Sat, 2018-06-23 23:29

Sorry, just realised this may be to do with something else and not the space.

I checked the .htaccess file, and I think because the re-write rule is within the standard Wordpress ifModule, it has overwritten it.

Is there a way I can put this in .htaccess as a 'standalone' rule?

Submitted by support on Sun, 2018-06-24 08:43

Hi,

As long as it's the first rule (after RewriteBase line) it shouldn't interfere with the WordPress rewrite (the L flag means "L"ast Rule) however I intended to use pto_common_hyphenate in the code instead of pto_common_normalise. I've corrected this above which should resolve the spaces issue; if still not redirecting properly or interfering with WordPress rewrite let me know and I'll check it out further...

Cheers,
David.
--
PriceTapestry.com

Submitted by PS on Sun, 2018-06-24 09:22

Thanks, David, I'll change it to the hyphenate code.

For the .htaccess, I'd feel more comfortable using a separate piece outside of the Wordpress markers as I'd be having to check all the time that the links are working and they've been down for a few days.

I read this and it recommends outside of the markers too for any custom code: {link saved}

Submitted by support on Mon, 2018-06-25 09:06

Hi Tim,

No problem - have a go with the following inserted before the # BEGIN WordPress marker (as the rule has to take precedence since WordPress uses a "catch all" rule...)

RewriteEngine On
RewriteBase /
RewriteRule ^out/(.*)/(.*)/$ pt/jump.php?id=$2 [L]

Cheers,
David.
--
PriceTapestry.com

Submitted by PS on Mon, 2018-06-25 15:18

Great thanks, that seems to be working well.