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
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

[Webinar] How Hackers Steal Your Credentials

Do You Know How Hackers Steal Your Credentials? Join us and Skyport Systems to learn how hackers steal your credentials and why Active Directory must be secure to stop them. Thursday, July 13, 2017 10:00 A.M. PDT

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Having worked on larger scale sites, we found out that you are bound to look at more scalable solutions to integrating widgets, code snippets or complete applications and mesh them into functional sites, in any given composition. To share some of…
Active Directory replication delay is the cause to many problems.  Here is a super easy script to force Active Directory replication to all sites with by using an elevated PowerShell command prompt, and a tool to verify your changes.
Learn the basics of if, else, and elif statements in Python 2.7. Use "if" statements to test a specified condition.: The structure of an if statement is as follows: (CODE) Use "else" statements to allow the execution of an alternative, if the …
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)

615 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