Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Google Analytics  pageTracker._addItem

Posted on 2008-10-23
5
Medium Priority
?
1,582 Views
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.



<script>
pageTracker._addTrans(
"InvoiceID", // Order ID
"AffName", // Affiliation
"InvoiceTotal", // Total
"ProductSold", // Product Sold
);
pageTracker._addItem(
"InvoiceID", // Order ID
"SKU", // SKU
"ProductName", // Product Name
"ProductPrice", // Price
"_qty" // Quantity
);
pageTracker._trackTrans();
</script>

Open in new window

0
Comment
Question by:3rdLifeWebDev
  • 4
5 Comments
 
LVL 21

Accepted Solution

by:
naspinski earned 2000 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.
0
 

Author Comment

by:3rdLifeWebDev
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.
0
 

Author Comment

by:3rdLifeWebDev
ID: 22815787
naspinski,

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 + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
</script>
<script type="text/javascript">
var pageTracker = _gat._getTracker("UA-XXXXXXXX-1");
pageTracker._setDomainName("none");
pageTracker._setAllowLinker(true);
pageTracker._initData();
pageTracker._trackPageview();
</script>
<script type="text/javascript">
pageTracker._setCampaignTrack(enable);
pageTracker._setCampNameKey(newCampNameKey);
pageTracker._setCampMediumKey(newCampMedKey);
pageTracker._setCampSourceKey(newCampSrcKey);
pageTracker._setCampTermKey(newCampTermKey);
pageTracker._setCampContentKey(newCampContentKey)
pageTracker._setCampIdKey(newCampIdKey);
</script>

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");
 
pageTracker._trackTrans();
</script>

Open in new window

0
 

Author Comment

by:3rdLifeWebDev
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.
0
 

Author Comment

by:3rdLifeWebDev
ID: 22933896
This is still an open question...any takers?
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

This article is meant to give a basic understanding of how to use R Sweave as a way to merge LaTeX and R code seamlessly into one presentable document.
In this blog, we’ll look at how improvements to Percona XtraDB Cluster improved IST performance.
The viewer will learn how to count occurrences of each item in an array.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
Suggested Courses

876 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