You are here:  » Add tracking ids to Commission Junction URL's

Support Forum



Add tracking ids to Commission Junction URL's

Submitted by Bigmac on Wed, 2011-02-16 07:21 in

Hi David,

I have a feed from a merchant that excludes my affiliate tracking id so I need to add it prior to importing it into PT. I guess I could do it normally using global filters however, this feed is for a Commission Junction merchant and CJ have told me to encode the URL's.

I see there is a PHP function 'string urlencode' that I can use and I could probably put together a script to do it given time but I wondered if this is something you have encountered before and whether there was a quicker solution?

Many thanks.

Hamish

Submitted by support on Wed, 2011-02-16 10:11

Hi Hamish,

Here's the code for a new urlencode filter:

  /*************************************************/
  /* urlEncode */
  /*************************************************/
  $filter_names["urlEncode"] = "URL Encode";
  function filter_urlEncodeConfigure($filter_data)
  {
    print "<p>There are no additional configuration parameters for this filter.</p>";
  }
  function filter_urlEncodeValidate($filter_data)
  {
  }
  function filter_urlEncodeExec($filter_data,$text)
  {
    return urlencode($text);
  }

Add the code to the end of your includes/filter.php (just before the closing PHP tag), and with that in place you can then add a new URL Encode filter to the Buy URL field for the feed, and then add a Text Before filter to prefix your tracking URL (which I imagine ends in something like &url=)

Hope this helps!

Cheers,
David.
--
PriceTapestry.com

Submitted by Bigmac on Wed, 2011-02-16 11:24

Hi David,

Top notch as always.

I initially tried it and it worked. I then made some changes to the feed and re registered it but I now keep getting the following error:

'There are no additional configuration parameters for this filter'

I have now tried it on another feed within the same installation and it does the same thing. Do you think it's something I have done?

Thanks again for your first class support.

Cheers,

Hamish

Submitted by support on Wed, 2011-02-16 11:31

Hi Hamish,

'There are no additional configuration parameters for this filter' is normal - the URL Encode filter doesn't require any additional information so that message is displayed in place of a form as some of the other filters have.

Make sure that you add the filters in sequence which is important, the URL Encode must be applied first that only the URL is encoded and not the entire field... and then followed by the Text Before filter to prefix your tracking URL...

Cheers,
David.
--
PriceTapestry.com

Submitted by Bigmac on Wed, 2011-02-16 11:45

Hi David,

Yes, it's me being a bit brain dead this morning.

Thanks again, works a treat.

Cheers,

Hamish

Submitted by Al on Wed, 2012-02-08 16:45

Hi all,

I implemented the code in filter.php, as I needed to add my ID to a merchant URL.

The only problem I am facing is that the link to the merchant is not generated properly.

This is in my feed:

http://www.merchantname.com/nl/p/computer/-/9000000011090909/index.html?plazapricecompare=true

I added &s=1234 (my ID) with the filter 'text after'

Now it outputs a link like this:

http://mysite.com/product/http://www.merchantname.com/nl/p/computer/-/9000000011090909/index.html?plazapricecompare=true&s=1234

So the s code is added properly, but there is something wrong with the first part of the link...

Submitted by support on Wed, 2012-02-08 16:53

Hello Al,

Your situation is actually slightly different to the one above and doesn't require the URL Encode filter.

Instead, I think all you need to use is a Text After filter against the Buy URL field, and in the text box on the configuration page for the filter, enter:

&s=1234

...and after the next import; your Buy URLs for that merchant will have your tracking parameter added at the end!

Cheers,
David.
--
PriceTapestry.com

Submitted by Al on Wed, 2012-02-08 17:03

That worked, thanks David!