Information Technology Reference
In-Depth Information
the Javascript object offers the opportunity to track the full suite of variables
we've discussed so far. to illustrate, let's replicate the standard merchandising example
from chapter 4 in a dynamic environment. the code would look like this:
version 4
var tracking_object = createITT();
tracking_object.ACTION='01';
tracking_object.DOCUMENTNAME='Confirmation';
tracking_object.DOCUMENTGROUP='Shopping cart';
tracking_object._S_SKU='DM112899;DM113834';
tracking_object._S_UNITS='2;1';
tracking_object._S_AMOUNTS='100.00;50.00';
tracking_object._S_DISCOUNT ='5.00';
tracking_object._S_TAX ='8.00';
tracking_object._S_SHIPPING ='20.00';
tracking_object.ORDERID='10099803';
tracking_object.AMOUNT='USD173.00'; ;
tracking_object.submit();
124
All of our version 4 examples are not completely obsolete in version 5, but ver-
sion 5 includes this Ajax functionality as a standard, and no specific code is needed for
you to track Ajax elements and the like. the version 4 Ajax tracking is similar to the
version 5 standard tracking. Here we've replicated the version 4 code:
version 5
var YWATracker = YWA.getTracker(“1000123xxxx”);
YWATracker.setDocumentName(“Confirmation“);
YWATracker.setDocumentGroup(“Shopping cart“);
YWATracker.setAction(“01“);
YWATracker.setSKU(“DM112899; DM113834“);
YWATracker.setUnits(“2;1“);
YWATracker.setAmounts(“100.00;50.00“);
YWATracker.setDiscount(“5.00“);
YWATracker.setTax(“8.00“);
YWATracker.setShipping(“20.00“);
YWATracker.setOrderId(“10099803“);
YWATracker.setAmount(“USD173.00“); ;
YWATracker.submit();
If you only wish to trigger an action without tracking a page view, you should
use the version 4 submit_action() or the version 5 YWATracker.submit_action(); func-
tion instead. Again, the technical part is almost obvious; the harder part is figuring out
when to choose one type of data instead of another type—such as choosing when to
register a full page view.
Search WWH ::




Custom Search