예제 #1
0
        /// -----------------------------------------------------------------------------
        /// <summary>
        /// Page_Load runs when the control is loaded
        /// </summary>
        /// <remarks>
        /// </remarks>
        /// <history>
        /// </history>
        /// -----------------------------------------------------------------------------
        protected void Page_Load(System.Object sender, System.EventArgs e)
        {
            try
            {
                ScriptManager.RegisterStartupScript(this, Page.GetType(), "PageSettings", GetPageClientScript(), true);
                if (!Page.IsPostBack && !Page.IsCallback)
                {
                    // do a marketing tracker check
                    try
                    {
                        if (Request["_mt"] != null)
                        {
                            long             _mt       = Convert.ToInt64(Request["_mt"]);
                            aqufitEntities   entities  = new aqufitEntities();
                            Marketing        marketing = entities.Marketings.Include("MarketingCampaign").FirstOrDefault(m => m.Id == _mt);
                            MarketingTracker track     = new MarketingTracker()
                            {
                                Marketing   = marketing,
                                Date        = DateTime.Now,
                                TrackUrl    = Request.Url.AbsoluteUri,
                                HostAddress = Request.UserHostAddress,
                                Referer     = Request.UrlReferrer.AbsoluteUri
                            };
                            entities.AddToMarketingTrackers(track);
                            entities.SaveChanges();

                            string trackerJs = "if( _gaq ){ " +
                                               "_gaq.push(['_trackEvent', 'MarketingTrack', 'Track: " + marketing.MarketingCampaign.Name + "', '" + Request.Url.AbsoluteUri + "', " + marketing.Id + "]); " +
                                               "}";

                            ScriptManager.RegisterStartupScript(this, Page.GetType(), "EventTracker", GetPageClientScript(), true);
                        }
                    }
                    catch (Exception) { }   // never fail because we are tracking...
                }
            }
            catch (Exception exc) //Module failed to load
            {
                Exceptions.ProcessModuleLoadException(this, exc);
            }
        }
예제 #2
0
        /// -----------------------------------------------------------------------------
        /// <summary>
        /// Page_Load runs when the control is loaded
        /// </summary>
        /// <remarks>
        /// </remarks>
        /// <history>
        /// </history>
        /// -----------------------------------------------------------------------------
        protected void Page_Load(System.Object sender, System.EventArgs e)
        {
            try
            {
                ScriptManager.RegisterStartupScript(this, Page.GetType(), "PageSettings", GetPageClientScript(), true);
                if (!Page.IsPostBack && !Page.IsCallback)
                {

                    // do a marketing tracker check
                    try
                    {
                        if (Request["_mt"] != null)
                        {
                            long _mt = Convert.ToInt64(Request["_mt"]);
                            aqufitEntities entities = new aqufitEntities();
                            Marketing marketing = entities.Marketings.Include("MarketingCampaign").FirstOrDefault(m => m.Id == _mt);
                            MarketingTracker track = new MarketingTracker()
                            {
                                Marketing = marketing,
                                Date = DateTime.Now,
                                TrackUrl = Request.Url.AbsoluteUri,
                                HostAddress = Request.UserHostAddress,
                                Referer = Request.UrlReferrer.AbsoluteUri
                            };
                            entities.AddToMarketingTrackers(track);
                            entities.SaveChanges();

                            string trackerJs = "if( _gaq ){ "+
                                                    "_gaq.push(['_trackEvent', 'MarketingTrack', 'Track: "+marketing.MarketingCampaign.Name +"', '"+Request.Url.AbsoluteUri+"', "+marketing.Id+"]); "+
                                                "}";

                            ScriptManager.RegisterStartupScript(this, Page.GetType(), "EventTracker", GetPageClientScript(), true);
                        }
                    }
                    catch (Exception) { }   // never fail because we are tracking...
                }

            }
            catch (Exception exc) //Module failed to load
            {
                Exceptions.ProcessModuleLoadException(this, exc);
            }
        }