TD

Following up on my previous FoxyCart/MODx Tutorial, more FoxyCart solutions have come my way.  I’ve recently had to implement pixel tracking onto a client’s website. FoxyCart has some good documentation on basic affiliate tracking, however I needed slightly altered data in my tracking image.  Luckily the FoxyCart JSON gives you access to more data, and with a little JavaScript you can get a lot more out.

In this small tutorial I will show you how to include custom tracking information on your receipt page, using JavaScript and the ^^receipt_only_begin^^ ^^receipt_only_end^^ placeholders.

If you’re trying to figure out how to place order data onto your receipt, you may first want to check out this documentation for the existing available placeholders to check that doesn’t already suffice.

The main issue I faced was that my order amount needed the value multiplied by 100 to remove the decimal, it also needed to be the subtotal without tax. While the ^^subtotal^^ exists, it’ll output my total as xx.xx e.g 24.99. What I’m looking for is 2499.

So in comes the FoxyCart JSON. Check out the documentation here.

With this available, we’re able to manipulate our data with JavaScript. In the <head> tag of your receipt template, we can place the following:

<script type=”text/javascript”>
window.onload = function() {
var price = fc_json.total_price;
newprice = price*100;
$(“#track”).html(“<img src=’http://yourtracking.com/&amount=”+newprice+”‘/>”);
}
</script>

Within the <body>tag of your receipt template, create the div #track

<div id=”track”></div>

This is where 0ur pixel tracking gets added.

As this is tracking, we only want the tracking image called once. FoxyCart has two useful tags to make sure this happens.  ^^receipt_only_begin^^ ^^receipt_only_end^^

Place these either side of your javascript

^^receipt_only_begin^^

<script type=”text/javascript”>
window.onload = function() {
var price = fc_json.total_price;
var newprice = price*100;
$(“#track”).html(“<img src=’http://yourtracking.com/&amount=”+newprice+”‘/>”);
}
</script>

^^receipt_only_end^^

This ensures that the javascript function won’t be called on any return visits to the receipt.

There we have our tracking code with custom values inserted. Using the JSON we could potentially create a loop to support multiple tracked products, and get other values such as quantity or category.

Apparently the next release of FoxyCart will see the whole preprocess and buildfoxycart functions a little easier to work with, but even now with a little knowledge FoxyCart is awesomely  flexible.

add comments

Online Video Community Survey

Posted by Sam Clarke on Wednesday May 19, 2010 Under Internet, Toasted Digital, video

Leigh Jackson has put together a 3 part survey on a new project based on creating and sharing film online. If you’re an aspiring film maker or interested in online development in general then check it out, as the results could benefit you in the future.

Update – survey now in one easily managable chunk!

Visit the survey

add comments

New website underway

Posted by Sam Clarke on Monday Dec 28, 2009 Under Development, Internet, Toasted Digital, design, illustration, viral games

Work on my new website is underway… I’m not gonna give too much away, but here’s an early sketch of what’s in store. The site will be Actionscript 3.0 and feature artwork and 3D imagery.
p27-12-09_2111

add comments

Over Here! Los Angeles – Auditions

Posted by Sam Clarke on Wednesday Dec 2, 2009 Under Internet, Toasted Digital, design, interactive ecard, viral games

Kicking off the Over Here! website’s life with a call for actresses to attend an open Audition, Saturday December 5th at Los Angeles Saban Theatre for the role of June, starring opposite Cody Linley. Expect more on this project soon. The show is scheduled for January 2010.

Visit the website: http://www.overherela.com

add comments

Without doubt, one of the most annoying parts of web design is making sure your website looks as nice in one browser as it does in another, and as all developers know, this takes time. It specifically takes a lot more time when having to test in IE6, which has no real accessible way to do so without using other or virtual machines.

So in comes the rather overwhelmingly named “Expression Web SuperPreview” from Microsoft. A stand-alone visual debugging tool, which lets you flick between and even onion-skin different versions of Internet Explorer. With the full release there’s promise of inclusion of other browsers you’ve installed locally such as Firefox and Safari, creating potentially a great cross browser testing tool.

You can download the preview version by clicking here.

The full version will be bundled with Expression Web 3 later on in the year, here’s hoping it delivers and helps ease that cross browser headache…

add comments