コード例 #1
0
    private string buildNXTJavaScript(OrderDetail od)
    {
        try
        {
            string jsCode = "";
            string strData = "";

            Functions.WebForms f = new Functions.WebForms();
            string nextopiaAccountName = f.GetAppSettings("nextopiaAccountName");
            string nextopiaId = f.GetAppSettings("nextopiaId");

            jsCode = "function nxtsubmit_purchase() {";
            jsCode = jsCode + "var nxturl = 'https://analytics.nextopia.net/p.php';";
            jsCode = jsCode + "var nxty = '" + nextopiaId + "';";
            jsCode = jsCode + "var nxtz = '1';";
            jsCode = jsCode + "info = new Image(1,1);";

            strData = od.OrderRow.order_id.ToString() + "|" + nextopiaAccountName + "|" + PrgFunctions.TryCastDouble(od.OrderRow.order_total).ToString() + "|" + PrgFunctions.TryCastDouble(od.OrderRow.order_tax).ToString() + "|" + PrgFunctions.TryCastDouble(od.OrderRow.order_shipping).ToString() + "|" + od.OrderRow.order_ship_city.ToString() + "|" + od.OrderRow.order_ship_state_name.ToString() + "|" + od.OrderRow.order_ship_country_name.ToString() + "\\n";

            foreach (DataRow dr in od.OrderItems.Rows)
            {
                strData = strData + od.OrderRow.order_id.ToString() + "|" + dr["item_cd"].ToString() + "|" + dr["order_item_description"].ToString() + "|Products|" + PrgFunctions.TryCastDouble(dr["item_wholesale_price"]).ToString() + "|" + dr["order_item_quantity"].ToString() + "\\n";
            }

            jsCode = jsCode + "info.src = nxturl + '?y=' + nxty + '&z=' + nxtz + '&x=' + escape('" + strData + "');}nxtsubmit_purchase();";

            return jsCode;
        }
        catch
        {
            return "";
        }
    }
コード例 #2
0
    private string buildGAJavaScript(OrderDetail od)
    {
        try
        {
            string jsCode = "";

            Functions.WebForms f = new Functions.WebForms();
            string googleAnalyticsAccountName = f.GetAppSettings("googleAnalyticsAccountName");
            string googleId = f.GetAppSettings("googleAnalyticsId");

            if (googleAnalyticsAccountName.Length != 0)
            {

                jsCode = "var pageTracker = _gat._getTracker('" + googleId + "'); pageTracker._trackPageview();";

                //TODO: Specific identifiers should be move to app.config
                jsCode = jsCode + "pageTracker._addTrans('" + od.OrderRow.order_id.ToString() + "', '" + googleAnalyticsAccountName + "', '" + PrgFunctions.TryCastDouble(od.OrderRow.order_total).ToString() + "', '" + PrgFunctions.TryCastDouble(od.OrderRow.order_tax).ToString() + "', '" + PrgFunctions.TryCastDouble(od.OrderRow.order_shipping).ToString() + "', '" + od.OrderRow.order_ship_city.ToString() + "', '" + od.OrderRow.order_ship_state_name.ToString() + "', '" + od.OrderRow.order_ship_country_name.ToString() + "' ); ";

                foreach (DataRow dr in od.OrderItems.Rows)
                {
                    jsCode = jsCode + "pageTracker._addItem('" + od.OrderRow.order_id.ToString() + " ', '" + dr["item_cd"].ToString() + "', '" + dr["order_item_description"].ToString() + "', 'Products', '" + PrgFunctions.TryCastDouble(dr["item_wholesale_price"]).ToString() + "', '" + dr["order_item_quantity"].ToString() + "'); ";
                }

                jsCode = jsCode + "pageTracker._trackTrans();";
            }
            return jsCode;
        }
        catch
        {
            return "";
        }
    }