0
private void GoogleAnalyticsJavascript()
{
//...
}

private void WriteMetaTags()
        {

                try
                {
                    MetaTagHelper metaControl = new MetaTagHelper();
                    metaControl.AddMetaTag("WT.pn_sku", GetSemicolonSeparatedValues(this.CurrentOrder, "ProductCode"), this.Page);
                    metaControl.AddMetaTag("WT.tx_u", GetSemicolonSeparatedValues(this.CurrentOrder, "Quantity"), this.Page);
                    metaControl.AddMetaTag("WT.tx_s", GetSemicolonSeparatedValues(this.CurrentOrder, "Total"), this.Page);
                    metaControl.AddMetaTag("WT.tx_e", "p", this.Page);
                    metaControl.AddMetaTag("WT.si_n", "Purchase", this.Page);
                    metaControl.AddMetaTag("WT.si_x", "7", this.Page);
                    metaControl.AddMetaTag("WT.ti", "Receipt", this.Page);
                    metaControl.AddMetaTag("WT.si_cs", "1", this.Page);
                    metaControl.AddMetaTag("WT.tx_cartid", this.CurrentOrder.Id, this.Page);
                    metaControl.AddMetaTag("WT.tx_i", this.CurrentOrder.OrderNumber, this.Page);
                    metaControl.AddMetaTag("WT.tx_id", this.CurrentOrder.DateModified.Value.ToString("d"), this.Page);
                    metaControl.AddMetaTag("WT.tx_it", this.CurrentOrder.DateModified.Value.ToString("H:mm:ss"), this.Page);

                    GoogleAnalyticsJavascript();

                }


                catch (Exception ex)
                {
                    ExceptionManager.HandleException(ex);
                }
            }

上面的代码有效,但我只想GoogleAnalyticsJavaScript()在转到“crazy.aspx”页面时触发。我正在使用它,但它不起作用。

string currentUrl = Request.Url.AbsoluteUri;
if (currentUrl.ToLower().Contains("crazy.aspx"))
{
    GoogleAnalyticsJavascript();
}

有什么建议么?

4

0 回答 0