You are here:  » Implement URL pixel - enter in product description


Implement URL pixel - enter in product description

Submitted by xslinx on Tue, 2012-04-03 09:28 in

Hi David,

I was wondering if it's possible to add a pixel or extra code to the outgoing-URL going to the supplier page. I would like to add some code to this URL for Google analytics.

Further I was wondering how I can add an 'enter' in the product description?

Thank a lot in advance!!

Best regards,
Jaimy

Submitted by support on Tue, 2012-04-03 10:31

Hello Jaimy,

One method that some users have implemented is to modify jump.php (of the Price Tapestry installation, not the plugin) to use an HTML redirect rather than HTTP, which means that you can include arbitrary HTML on the page, such as Google Analytics or tracking pixel code). The replacement jump.php is as follows:

<?php
  require("includes/common.php");
  $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);
  print "<html>";
  print "<head>";
  print "<meta http-equiv='refresh' content='1;url=".$product["buy_url"]."' />";
  print "</head>";
  print "<body>";
?>
<!-- Tracking Pixel or Google Analytics HTML Code Here -->
<?php
  print "</body>";
  print "</html>";
?>

Don't forget to make sure that the plugin is configured to use jump.php - set $config_useTracking to TRUE in the drop-down on wp-admin > Settings > PriceTapestry.org (scroll down to the External section)...

Regarding new lines in (custom) descriptions you can use the HTML code <br />...

Hope this helps!

Cheers,
David.
--
PriceTapestry.com

Submitted by xslinx on Tue, 2012-04-03 11:45

Thanks David, I'll git it a go!

Strange thing with the because I've tried that using pmimport.php feed, but that didn't work.
It works fine using the description directly in product mapping, so that's okay too!

Best regards,
Jaimy

Submitted by xslinx on Wed, 2012-04-04 12:48

Hi David,

I've got another question about the product mapping product description. Is it possible to use the embedded youtube code to add some movies in the description. I've already tried it, but failed. Perhaps there is something else to consider, than just pasting the code in the description field.

Best regards,
Jaimy

Submitted by support on Wed, 2012-04-04 14:08

Hi Jaimy,

There isn't any post processing of the custom description content so they should display correctly - at least on the product page but what might cause a problem is the truncated descriptions as shown on search result pages. In pto_search.php the descriptions are cleanly truncated (first space after specified length) by the following code on line 466:

      $each = str_replace("%DESCRIPTION%",pto_common_substr($row->description,200,"..."),$each);

So one thing to try would be to REPLACE that with:

      $each = str_replace("%DESCRIPTION%",$row->description,$each);

That will display the full description field in search results and might be all it is. If not; if you could perhaps post an example of the sort of embedding code you're adding and I'll give it a go on my test server...

Cheers,
David.
--
PriceTapestry.com

Submitted by xslinx on Wed, 2012-04-04 16:30

Hi David,

That unfortuanately didn't do the trick.

Could you try it on you test server? I've tried the following youtube code:

<iframe width="420" height="315" src="http://www.youtube.com/embed/9yRKHs9vPSE" frameborder="0" allowfullscreen></iframe>

This results to an iframe on my product page, viewing my own website.

and also the old embedded code:

<object width="420" height="315"><param name="movie" value="http://www.youtube.com/v/9yRKHs9vPSE?version=3&amp;hl=nl_NL"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/9yRKHs9vPSE?version=3&amp;hl=nl_NL" type="application/x-shockwave-flash" width="420" height="315" allowscriptaccess="always" allowfullscreen="true"></embed></object>

This results to nothing on the product page.

Best regards,
Jaimy

Submitted by support on Wed, 2012-04-04 17:16

Hello Jaimy,

Both versions worked fine on my test server i'm afraid - the video was embedded as expected so it sounds like something maybe re-writing the URLs on your server - possibly another plugin for example.

Could you perhaps let me know the URL of a page on your site containing a product with a mapped description containing the embedded code (presumably the newer iframe version is the ideal one to get working) - i'll remove the URL before publishing your reply and then I can view the source to see how the output compares to the mapped description...

Thanks,
David.
--
PriceTapestry.com

Submitted by xslinx on Thu, 2012-04-05 06:00

Hi David,

The url is: {link saved}

Thanks for your wonderful service!

Best regards,
Jaimy

Submitted by support on Thu, 2012-04-05 08:17

Hi Jaimy,

I see what's happened - the quote characters in the embed HTML have been escaped - this is handled when magic quote settings for gpc and runtime are the same but it's becoming more common for PHP installations to differ. To correct this, within your Price Tapestry installation edit the file includes/widget.php and look for the following code at line 119:

if (get_magic_quotes_runtime())

...and REPLACE with:

if (get_magic_quotes_gpc())

You will need to re-edit the mapping containing the embedded code, save and re-import for the changes to take effect...

Hope this helps!

Cheers,
David.
--
PriceTapestry.com

Submitted by xslinx on Thu, 2012-04-05 08:24

Hi David,

That works like a charm!! Thank's a million.

Best regards,
Jaimy

Submitted by xslinx on Thu, 2012-04-12 11:08

Hi David,

Sorry for the dalay in responing on the jump.php file.
Ive changed the intire code in jump.php into:

<?php
  require("includes/common.php");
  $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);
?> <--- remove this
  print "<html>";
  print "<head>";
  print "<meta http-equiv='refresh' content='1;url=".$product["buy_url"]."' />";
  print "</head>";
  print "<body>";
?>
<script type="text/javascript">
{code saved}
</script>
<?php
  print "</body>";
  print "</html>";
?>

But now i get redirected to 'page not found' and see very briefly the folling text: print""; print""; print""; print"";?>
Probably I'm just an idiot who doesn't know how to insert the google code....so could you please help me!

Best regards,
Jaimy

Submitted by support on Thu, 2012-04-12 11:22

Hi Jaimy,

There was a supurflous closing PHP tag in the code. I've corrected the original at the top of the thread; and in your code (i've removed your tracking JavaScript) look for

?> <--- remove this

..and delete that line - that should be all it is!

Cheers,
David.
--
PriceTapestry.com

Submitted by xslinx on Thu, 2012-04-12 12:16

Hi David!

Yep that did the trick! Many thanks!

Best regards,
Jaimy