Archive for April 29th, 2009

Google Analytics Tracking Code 跟踪产品信息的js写法

<!– Google Analytics Tracking Code – Provided by PM Tian – START –>

<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”><!–
try {
var pageTracker = _gat._getTracker(“UA-425001-1″);
pageTracker._setDomainName(“.dhgate.com”);
pageTracker._setVar(“Real Buyer”);

pageTracker._addTrans(
“1234″,                                     // Transaction ID
“Mountain View”,                            // PayPal|Capinfo
“11.99″,                                    // Total
“1.29″,                                     // Tax, N/A
“5″,                                        // Shippingfee
“San Jose”,                                 // City
“California”,                               // State
“USA”                                       // Country
);

pageTracker._addItem(
“1234″,                                     // Order Number (PO)
“DD44″,                                     // Item Code
“T-Shirt”,                                  // Product Name
“Green Medium”,                             // Category Code
“11.99″,                                    // Price – required
“1″                                         // Quantity – required
);

pageTracker._trackTrans();
} catch(err) {}
// –></script>

<!– Google Analytics Tracking Code – Provided by PM Tian – END –>

No Comments

用geo查IP这个。。粉简单。。

inc文件在这里http://geolite.maxmind.com/download/geoip/api/php/geoip.inc 应该留着这个能更新一下
更精确的在 http://geolite.maxmind.com/download/geoip/api/php/geoipcity.inc
数据文件在

http://geolite.maxmind.com/download/geoip/database/GeoLiteCountry/GeoIP.dat.gz

  1. #!/usr/bin/php -q
  2. <?php
  3. // This code demonstrates how to lookup the country by IP Address
  4. include("geoip.inc");
  5. // Uncomment if querying against GeoIP/Lite City.
  6. // include("geoipcity.inc");
  7. $gi = geoip_open("/usr/local/share/GeoIP/GeoIPCity.dat",GEOIP_STANDARD);
  8. echo geoip_country_code_by_addr($gi, "24.24.24.24") . "\t" .
  9.      geoip_country_name_by_addr($gi, "24.24.24.24") . "\n";
  10. echo geoip_country_code_by_addr($gi, "80.24.24.24") . "\t" .
  11.      geoip_country_name_by_addr($gi, "80.24.24.24") . "\n";
  12. geoip_close($gi);
  13. ?>

1 Comment