Google Analytics  pageTracker._addItem

Posted on 2008-10-23
Last Modified: 2012-05-05
I am working to update my shopping cart to pass data back to google upon purchase.

The following code goes on my success page.

The question is....for the pageTracker._addItem(), do I need to add this info for EVERY product in my storefront?

I have 40 products, which would mean 40 entries of data in the html section of the product.



"InvoiceID", // Order ID

"AffName", // Affiliation

"InvoiceTotal", // Total

"ProductSold", // Product Sold



"InvoiceID", // Order ID

"SKU", // SKU

"ProductName", // Product Name

"ProductPrice", // Price

"_qty" // Quantity




Open in new window

Question by:3rdLifeWebDev
  • 4
LVL 21

Accepted Solution

naspinski earned 500 total points
ID: 22795194
Yes you do, otherwise, how will the widget know what it is to track?

Since all of these values are already in a database (I am assuming) - why not write a program to write those tags for you?  It would be much easier.

Author Comment

ID: 22809081
I am going to download to a .csv file all of the products. Then through concatenation add all of the tag info.

That should make it easy.

Author Comment

ID: 22815787

Would you mind reviewing this for me?

This goes on my front end site:

<script type="text/javascript">
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
document.write(unescape("%3Cscript src='" + gaJsHost + "' type='text/javascript'%3E%3C/script%3E"));
<script type="text/javascript">
var pageTracker = _gat._getTracker("UA-XXXXXXXX-1");
<script type="text/javascript">

The code attached goes on my sales success page.

<script type="text/javascript">

pageTracker._addTrans(OrderId, AffiliateId, OrderTotal

, OrderTax, "", Contact0City, Contact0State, Contact0Country);

pageTracker._addItem("p37","AASL1","All About  Level 1 set","","$29.95","p37_qty");pageTracker._addItem("p38","AASL2","All About  Level 2 Set","","$29.95","p38_qty"); pageTracker._addItem("p39","AASL3","All About  Level 3 set","","$39.95","p39_qty"); pageTracker._addItem("p40","SMP1","All About  Level 1 Material Packet","","$12.95","p40_qty"); pageTracker._addItem("p41","SMP2","All About  Level 2 Material Packet","","$12.95",'p41_qty"); pageTracker._addItem("p42","SMP3","All About  Level 3 Material Packet","","$17.95","p42_qty"); pageTracker._addItem("p44","TILES","Letter Tiles","","$9.95","p44_qty"); 

pageTracker._addItem("p45","PHON","Full Set of Cards","","$12.95","p45_qty"); pageTracker._addItem("p46","AUDIO"," Audio CD-ROM","","$14.95","p46_qty"); pageTracker._addItem("p47","FFGAME","File Folder Game","","$7.95","p47_qty"); pageTracker._addItem("p48","BINGO"," Bingo Game","","$7.95","p48_qty"); pageTracker._addItem("p49","MAG","Magnets for Letter Tiles","","$5.95","p49_qty"); pageTracker._addItem("p80","Not Set","Ph Audio CD-ROM - FREE!","","$0.00","p80_qty"); pageTracker._addItem("p82","Not Set","Mag LT - FREE!","","$0.00","p82_qty");

pageTracker._addItem("p50","Not Set","International Shipping","","$50.00","p50_qty"); pageTracker._addItem("p51","Not Set","Priority Mail $0-$19.99","","$4.95","p51_qty"); pageTracker._addItem("p53","Not Set","Ph Bingo Game - FREE!","","$0.00","p53_qty"); pageTracker._addItem("p55","Not Set","Priority Mail $20-$44.99","","$7.95","p55_qty"); pageTracker._addItem("p57","Not Set","Priority Mail $45-169.99","","$9.95","p57_qty"); pageTracker._addItem("p59","Not Set","Priority Mail $170-249.99","","$12.95","p59_qty"); pageTracker._addItem("p61","Not Set","Priority Mail $250+","","$15.95","p61_qty"); pageTracker._addItem("p69","AASL4","All About Spelling Level 4 Set","","$39.95","p69_qty"); pageTracker._addItem("p63","Not Set","AAS L1 Book","","$17.00","p63_qty");

pageTracker._addItem("p65","Not Set","AAS L2 Book","","$17.00","p65_qty");

pageTracker._addItem("p67","Not Set","AAS L3 Book","","$22.00","p67_qty"); 

pageTracker._addItem("p71","SMP4","All About  Level 4 Material Packet","","$17.95","p71_qty"); 

pageTracker._addItem("p73","Not Set","Shipping","","$50.00","p73_qty"); 

pageTracker._addItem("p75","Not Set","Shipping to Canada","","$50.00","p75_qty"); pageTracker._addItem("p77","Not Set","Shipping to UK","","$75.00","p77_qty");

pageTracker._addItem("p79","Not Set","Shipping to Australia","","$100.00","p79_qty"); pageTracker._addItem("p84","Not Set","Free Ph Audio CD-ROM","","$0.00","p84_qty"); pageTracker._addItem("p86","Not Set","Test Product","","$0.01","p86_qty");

pageTracker._addItem("p88","Not Set","Free Progress Chart Bee Stickers","","$0.00","p88_qty"); pageTracker._addItem("p90","Not Set","AAS L1 review copy","","$0.00","p90_qty"); 

pageTracker._addItem("p92","Not Set","AAS L2 Review copy","","$0.00","p92_qty"); 

pageTracker._addItem("p94","Not Set"," AAS L3 Review copy","","$0.00","p94_qty"); pageTracker._addItem("p96","Not Set","AAS L4 Review copy","","$0.00","p96_qty"); 

pageTracker._addItem("p98","Not Set","Letter tiles (review copy)","","$0.00","p98_qty"); pageTracker._addItem("p100","Not Set","Mag LT review copy","","$0.00","p100_qty"); pageTracker._addItem("p102","Not Set","Ph Audio CD-ROM (review copy)","","$0.00","p102_qty"); pageTracker._addItem("p104","Not Set","Bundled Review","","$0.00","p104_qty");

pageTracker._addItem("p106","Not Set","All About ","","$34.95","p106_qty"); pageTracker._addItem("p108","Not Set","All About ebook","","$32.95","p108_qty");



Open in new window


Author Comment

ID: 22822410
Could anyone help with this? My GA is tracking page hits and entrance paths, but is not passing keywords or any order information.

I would greatly apprectiate it.

Author Comment

ID: 22933896
This is still an open question...any takers?

Featured Post

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

This article discusses the difference between strict equality operator and equality operator in JavaScript. The Need: Because JavaScript performs an implicit type conversion when performing comparisons, we have to take this into account when wri…
This article will show, step by step, how to integrate R code into a R Sweave document
Learn the basics of modules and packages in Python. Every Python file is a module, ending in the suffix: .py: Modules are a collection of functions and variables.: Packages are a collection of modules.: Module functions and variables are accessed us…
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now