Data hosted with ♥ by Pastebin.com - Download Raw - See Original
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  2. <html xmlns="http://www.w3.org/1999/xhtml">
  3. <head>
  4. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  5. <meta http-equiv="P3P" content='CP="CAO PSA OUR"'><!-- This encourages IE to track 3rd Party content/cookie. -->
  6. <title>Secondary Domain : iFrame Test Page V2</title>
  7. <!-- Inside the iFrame the JavaScript needs to be above the links/content Google recommends just above </head> -->
  8. <script type="text/javascript">    
  9.     var _gaq = _gaq || [];    
  10.     _gaq.push(['_setAccount', 'UA-XXXXXXXX-8']);  // Same Google Analytics account as iFrame parent
  11.     _gaq.push(['_setAllowLinker', true]);    
  12.     _gaq.push(['_setDomainName', 'none']);  // none = correct, set to overide secondary domain actual value
  13.     _gaq.push(['_trackPageview']); // Must track page view before tracking transaction
  14.    
  15.     // E-commerce specific tracking requires up to 3+ pushes, must be on the completed sale page in header.
  16.     // Push one is the transaction
  17.     // Not all arguments are required but it is necessary to at least send an empty string '' as the number of arguments matters
  18.     _gaq.push(['_addTrans',
  19.                '12224',             // transaction ID - required    
  20.                '6042021561',        // affiliation or store name    
  21.                '275.50',            // total - required    
  22.                '26.50',             // tax    
  23.                '10.00',             // shipping (transaction) fee    
  24.                'Surrey',            // city    
  25.                'British Columbia',  // state or province    
  26.                'Canada'             // country  
  27.                ]);
  28.     // One push for each item in the transaction shopping cart
  29.     _gaq.push(['_addItem',    
  30.              '12224',               // transaction ID - required, should match transaction ID in push above    
  31.              'Brave New World',     // SKU/code - required MOST SPECIFIC  
  32.              'Fiction',             // product name MOST PROMINANT in Google Analytics  
  33.              'Books',             // category or variation BROADEST
  34.              '132.50',              // unit price - required    
  35.              '2'                    // quantity - required  
  36.              ]);
  37.     // Final transaction related push
  38.     _gaq.push(['_trackTrans']);
  39.  
  40.     (function() {        
  41.         var ga = document.createElement('script');
  42.         ga.type = 'text/javascript';
  43.         ga.async = true;        
  44.         ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';        
  45.                   var s = document.getElementsByTagName('script')[0];
  46.                   s.parentNode.insertBefore(ga, s);    
  47.                  })();  
  48.     // In the Google Chrome Analytics debugging plugin this will show as 4 seperate tracking beacons sent.
  49. </script>
  50. </head>
  51. <body>
  52.  
  53. <p>
  54. Text inside of an iFrame on another domain, in order to track links to this page consider using:
  55. <pre>
  56. onclick="_gaq.push(['_link', this.href]); return false;"
  57. </pre>
  58. </p>
  59.  
  60. <ul>
  61. <!-- As a bonus here is how to fire an onpage event, this will send another tracking beacon back to the mothership -->
  62. <li><a href="#" onClick="_gaq.push(['_trackEvent', 'Videos', 'Play', 'Played Product Video']); return false;">Track Event inside iFrame</a></li>
  63. </ul>
  64. <!-- FYI there is also a _linkByPost for form submission and a _trackSocial event, they are less simple to demo -->
  65. </body>
  66. </html>