?
Solved

Google Analytics  pageTracker._addItem

Posted on 2008-10-23
5
Medium Priority
?
1,581 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
[X]
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
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

RHCE - Red Hat OpenStack Prep Course

This course will provide in-depth training so that students who currently hold the EX200 & EX210 certifications can sit for the EX310 exam. Students will learn how to deploy & manage a full Red Hat environment with Ceph block storage, & integrate Ceph into other OpenStack service

Question has a verified solution.

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

Batch, VBS, and scripts in general are incredibly useful for repetitive tasks.  Some tasks can take a while to complete and it can be annoying to check back only to discover that your script finished 5 minutes ago.  Some scripts may complete nearly …
This article discusses how to implement server side field validation and display customized error messages to the client.
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 …
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
Suggested Courses

719 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