You are here:  » Edit jump page


Edit jump page

Submitted by technoarenasol on Fri, 2012-12-28 16:42 in

Hi David

I have one java script for generating automatic affiliated URL ....so how can i insert that javascript in jump page ?

Thanks Amin

Submitted by support on Fri, 2012-12-28 18:02

Hi Amin,

This depends how much of the HREF / HTML the JavaScript generates. Could you post an example of the actual "Buy URL" JavaScript code that is in the feed and I'll check it out for you (I'll remove the code before publishing your reply)...

Thanks,
David.
--
PriceTapestry.com

Submitted by technoarenasol on Fri, 2012-12-28 18:13

technoarenasol

David actually this script first check URL than automatic create one URL.Suppose URL of ebay product

ebay.com/mobile/nokia-mobile-phone

automatically change to like

cueins.com/affid?200&merchantid=550="ebay.com/mobile/nokia-mobile-phone

This javascript code detect automatically merchant URL but pricetapestry not showing Original URL in "Buy link". javascript :

<script type='text/javascript'>
   var pubID = '{code removed}';
   (function(d, t) {
   var s = document.createElement('script');s.type = 'text/javascript';
   s.async = true;s.src = 'http://cdn0.cuelinks.com/js/cuelinksv1.js';
   document.getElementsByTagName('body')[0].appendChild(s);
   }());
</script>

Submitted by support on Sat, 2012-12-29 11:10

Hi technoarenasol,

You'll need to do 2 things here. Firstly, since the URLs need to be re-written, you need to prevent jump.php redirection for this merchant (I assume "eBay", but change in the following example if not). To do this, in includes/tapestry.php, look for the following code at line 83:

    if ($config_useTracking)
    {
      return $config_baseHREF."jump.php?id=".$product["id"];
    }

...and REPLACE with:

    if ($config_useTracking && ($product["merchant"]<>"eBay"))
    {
      return $config_baseHREF."jump.php?id=".$product["id"];
    }

Finally, at the _end_ of html/product.php, add the following code:

<?php
foreach($product["products"] as $p)
{
  if ($p["merchant"]=="eBay")
  {
    ?>
    <script type='text/javascript'>
    var pubID = '{code removed}';
    (function(d, t) {
      var s = document.createElement('script');s.type = 'text/javascript';
      s.async = true;s.src = 'http://cdn0.cuelinks.com/js/cuelinksv1.js';
      document.getElementsByTagName('body')[0].appendChild(s);
    }());
    </script>
    <?php
    break;
  }
}
?>

(don't forget to replace back {code removed} with your cuelinks.com publisher ID)

Cheers,
David.
--
PriceTapestry.com

Submitted by technoarenasol on Sat, 2012-12-29 11:57

technoarenasol

Hi David...This script not only for eBay merchant.This script use fro all merchant...This script only detect only original buy link....So I think better to put script into jump.php page.

Thanks
Amin

Submitted by support on Sun, 2012-12-30 10:06

Hi Amin,

This is a little tricky to implement within jump.php but I think it can be done as follows. Please check this out very carefully so that you are confident that it is working as required. The requirement is that the link is not executed until your rewrite JavaScript has re-written the URL into your affiliate link, and since you don't have any control over how that JavaScript works it has to be done independently by studying the link's HREF attribute and waiting for it to change. Once it has changed, the user can be redirected using window.location.

Firstly, edit jump.php and look for the following code at line 14:

  header("Location: ".$product["buy_url"]);
  exit();

...and either comment out or DELETE those lines.

Next, add the following code after the closing PHP tag at the end of the file:

<!DOCTYPE HTML>
<html>
<body>
<a id='go' href='<?php print $product["buy_url"]; ?>'>
Click here if you are not redirected within 5 seconds
</a>
<script>
var buy_url = '<?php print $product["buy_url"]; ?>';
function go()
{
  if (document.getElementById("go").href <> buy_url)
  {
    window.location = document.getElementById("go").href;
  }
  window.setTimeout("go()",1000);
}
window.setTimeout("go()",1000);
var pubID = '{code removed}';
(function(d, t) {
  var s = document.createElement('script');s.type = 'text/javascript';
  s.async = true;s.src = 'http://cdn0.cuelinks.com/js/cuelinksv1.js';
  document.getElementsByTagName('body')[0].appendChild(s);
}());
</script>
</body>
</html>

(as before, don't forget to replace {code removed} with your cuelinks.com publisher ID)

Cheers,
David.
--
PriceTapestry.com