You are here:  » api links via jump.php


api links via jump.php

Submitted by philstone on Sun, 2016-12-11 22:40 in

Hi David

Hope you are well

I was wondering is it possible to force api links like kelkoo, amazon, ebay etc to pass through jump.php? I'm using the jump file for adwords conversion tracking but not getting the proper stats for these unfortunately as they just link direct

Thanks

Phil

Submitted by support on Mon, 2016-12-12 09:43

Hi Phil,

Sure - first of all, create "dummy" feeds for each API merchant that you wish to track - it won't import any products, but is just to create an entry in the pt_feeds table against which to count clicks just as feed merchants. For each API merchant, make CSV file in the feeds folder for

feeds/amazon.csv

ProductName,BuyURL,Price
Dummy,http://www.example.com/

Register and "Import" each feed to create the pt_feeds table entry against which to track clicks.

Then modify each of your API scripts and locate the point at which the buy_url value is set in the virtual product record e.g.

  $amazonRecord["buy_url"] = htmlspecialchars($item["DETAILPAGEURL"]);

...and modify to create a virtual filename field, matching the dummy CSV file created for that API merchant, e.g.

  $amazonRecord["buy_url"] = htmlspecialchars($item["DETAILPAGEURL"]);
  $amazonRecord["filename"] = "amazon.csv";

Then in includes/tapestry.php (I think the version you are running is already quite heavily modified with gclid tracking etc. so let me know if you're not sure at all) and locate where the buy_url is returned directly for API merchants, around line 129:

      return $product["buy_url"];

...and REPLACE with:

      $retval = "http://".$_SERVER["HTTP_HOST"].$config_baseHREF."jump.php?filename=".urlencode($product["filename"])."&url=".urlencode($product["buy_url"]);
      return $retval;

Again, I think the jump.php that you are using is also quite heavily modified so look for where you currently have around line 29:

  if (!$id) exit();

...and REPLACE with:

  if (!$id)
  {
    $sql = "UPDATE `".$config_databaseTablePrefix."feeds` SET clicks=clicks+1 WHERE filename = '".database_safe($_GET["filename"])."'";
    database_queryModify($sql,$result);
    header("Location: ".$_GET["url"]);
    exit();
  }

After changes double check that both feed and API Visit Store links are working as expected of course, just in case...

Hope this helps!

Cheers,
David.
--
PriceTapestry.com

Submitted by philstone on Tue, 2018-04-03 22:03

Hi David

Just getting a look at this now

i spotted a missing ")" in the tapestry.php edit, but i'm stuck with the jump.php code as mine is so heavily changed, I have had to comment out the $amazonRecord["id"] in amazonproduct.php as it interferes with the imageCache.php script, but cannot get the jump.php script to work for api links in the price table.

Any ideas how i can get the jump.php code below to work?

{code saved}

I haven't been using this script for sometime but am keen to start using it again.

Thanks

Phil

Submitted by support on Wed, 2018-04-04 11:59

Hello Phil,

From the version you posted, where you have the following code beginning at line 17:

  $sql = "SELECT filename,buy_url FROM `".$config_databaseTablePrefix."products`
    WHERE id='".database_safe($_GET["id"])."'";
  database_querySelect($sql,$rows);
  $product = $rows[0];
  $sql = "UPDATE `".$config_databaseTablePrefix."feeds` SET clicks=clicks+1
    WHERE filename = '".$product["filename"]."'";
  database_queryModify($sql,$insertID);

...REPLACE with:

  if (!isset($_GET["id"]))
  {
    $product["filename"] = $_GET["filename"];
    $product["buy_url"] = $_GET["url"];
  }
  else
  {
    $sql = "SELECT filename,buy_url FROM `".$config_databaseTablePrefix."products`
      WHERE id='".database_safe($_GET["id"])."'";
    database_querySelect($sql,$rows);
    $product = $rows[0];
  }
  $sql = "UPDATE `".$config_databaseTablePrefix."feeds` SET clicks=clicks+1
    WHERE filename = '".database_safe($product["filename"])."'";
  database_queryModify($sql,$insertID);

Hope this helps!

Cheers,
David.
--
PriceTapestry.com

Submitted by philstone on Wed, 2018-04-04 21:25

Thanks David

I tried this

everything works perfect for non-api links but still not getting anywhere with the api links

Notice: Undefined offset: 0 in /home/********/public_html/jump.php on line 36

which refers to:

    $product = $rows[0];

I tried enabling the $amazonRecord["id"] but it still didn't work, then this causes an issue with the imageCache.php file.

when i hover over the link after enabling

$amazonRecord["id"] = $item["ASIN"];

i get a value after the jump.php?id=****** but the error code above still comes up in jump.php and the page just gets stuck in a loop. i have disabled jump.php for now but any help to solve this would be greatly appreciated.

I checked over all the steps above and all amendments were made

Regards

Phil

Submitted by philstone on Wed, 2018-04-04 22:00

sorry just realising this works without turning tracking on. all is working great!!

Thanks!