天道酬勤,学无止境

How can I remove duplicated page events in Sitecore 8.1?

I have a processor in the <registerPageEvent> pipeline that checks whether an event is duplicated and removes it. It works well on 7.2, but I have to upgrade to 8.1 Update 3 and I can't find a way to remove an already added page event. Is this possible and how can I do that?

Piece of code from 7.2:

Tracker.Visitor.DataSet.PageEvents.Rows.RemoveAt(Tracker.Visitor.DataSet.PageEvents.Count - 1);

评论

You cannot remove events via the API starting from Sitecore 7.5. (The only way around would be to use .NET reflection)

Even in 7.2, doing this was a bad idea. The reason being, when an event is added via the API, some internal logic is applied - e.g. the visit's total value is recalculated. If you remove an event manually, these internal actions will not be triggered, and hence, your visit data may end up in an inconsistent state.

The best approach for you would be to add checks in the code that registers your events - an event should only be registered if it's not a duplicate of an existing event.

受限制的 HTML

  • 允许的HTML标签:<a href hreflang> <em> <strong> <cite> <blockquote cite> <code> <ul type> <ol start type> <li> <dl> <dt> <dd> <h2 id> <h3 id> <h4 id> <h5 id> <h6 id>
  • 自动断行和分段。
  • 网页和电子邮件地址自动转换为链接。

相关推荐
  • Sitecore 8.1 output cache not clearing
    we have CA and CD on different servers hosted in Azure Web Apps written using ASP.NET MVC. I've added below so that output cache gets cleared upon publish end. <event name="indexing:end:remote"> <handler type="Sitecore.ContentSearch.Maintenance.IndexDependentHtmlCacheManager, Sitecore.ContentSearch" method="Clear"/> </event> However, the output cache doesn't get cleared and website content doesn't get updated. Any configuration that I need to do on top of above? Thanks.
  • How to generate media item link with id instead of path in Sitecore
    Anyone knows how to generate links in sitecore with ID instead of item path? If you use GetMediaUrl method from the API, I can get this URL: /~/media/Images/Archive/content/News and Events/News_and_Events_Level2/20070419162739/iwhiz3.jpg The problem with this approach is that if someone changes the media item name, removes it somewhere or deletes it, the above link will break. I notice if I insert a media link from rich text editor, I get the link as below: /~/media/14BDED00E4D64DFD8F74019AED4D74EB.ashx The second link is better because it's using the item id, so if the actual media item is
  • Optimisation tips when migrating data into Sitecore CMS
    I am currently faced with the task of importing around 200K items from a custom CMS implementation into Sitecore. I have created a simple import page which connects to an external SQL database using Entity Framework and I have created all the required data templates. During a test import of about 5K items I realized that I needed to find a way to make the import run a lot faster so I set about to find some information about optimizing Sitecore for this purpose. I have concluded that there is not much specific information out there so I'd like to share what I've found and open the floor for
  • Sitecore页面编辑器-如何扩展页面编辑器项目编辑面板(Sitecore page editor - how to extend page editor item editing panel)
    问题 需要在页面编辑器的项目编辑部分添加“发布”功能。 (在“更多”部分下将是理想的)。 我怎样才能做到这一点? 回答1 首先,您需要创建一个命令类。 最简单的版本是: using System; using Sitecore.Shell.Applications.WebEdit.Commands; using Sitecore.Shell.Framework; using Sitecore.Shell.Framework.Commands; namespace my.assembly.namespace { [Serializable] public class Publish : WebEditCommand { public override void Execute(CommandContext context) { if (context.Items.Length != 1) return; Items.Publish(context.Items[0]); } } } 在Sitecore.config (或Commands.config )中注册新命令: <configuration> <sitecore> <commands> <command name="my:publish" type="my.assembly.namespace.Publish,my
  • Sitecore 允许访问父节点周围的子节点(Sitecore enables accessing child node around parent)
    问题 我有一个 sitecore 多站点设置。 我目前正在努力解决“重复内容综合症”,因为 google bot 为我的网站编制了索引,并且能够访问对方网站的内容。 这意味着它会在 2 个不同的主机名上找到相同的内容,这在 google 搜索中给这些网站一个较低的评级。 它发现重复内容的原因是,我能够通过在 URL 中键入名称来访问 oppsosite 站点上的子节点,而不是我当前正在浏览的子节点。 这是我对站点的 web.config 设置: <站点名称="website2" hostName="local.domain.dk" virtualFolder="/" >physicalFolder="/" rootPath="/sitecore/content/talk" startItem="/" database="web" domain=" extranet" allowDebug="true" cacheHtml="true" htmlCacheSize="10MB" registryCacheSize="0" viewStateCacheSize="0" xslCacheSize="5MB" filtersItemsCacheSize="2MB" enablePreview="true" enableWebEdit="true" enableDebugger=" true
  • Language Fallback not working for Fields with Standard Values (Sitecore 8.1)
    We had an issue where we enabled fallback language settings at the item level on a base template so that it would apply to all of our items. It worked for about 90% of our items but not for others even though the sitecore content editor indicated that it was working. Placing this here for anyone else who has this issue. I didnt find a specific solution for this issue on Google and was lucky enough to figure it out. Hopefully this can help someone else out too. Our setup is Sitecore 8.1 with Habitat Asp.net MVC
  • 如何在 Sitecore 中删除损坏的链接(How to remove broken links in Sitecore)
    问题 我们有一个 Sitecore 站点,其中有几个项目的链接已断开,指向不再存在的旧工作流程状态。 我知道您可以在删除项目时删除链接,但是当丢失的项目已经消失时,我没有看到简单地删除项目上断开的链接的界面。 在这种情况下,删除断开链接的最佳方法是什么? 谢谢。 回答1 Sitecore 管理页面允许删除损坏的链接。 你可以在这里找到它: http://localhost/sitecore/admin/RemoveBrokenLinks.aspx 您只需选择数据库并执行操作。 您还可以序列化在此过程中更改的所有项目。 您可能需要更改web.config超时设置: <setting name="DefaultSQLTimeout" value="10:00:00" /> <setting name="DataProviderTimeout" value="00:00:00" /> 回答2 Sitecore 在 web.config 的 LinkDatabase 部分指定的数据库中维护一个名为 Links 的表。 您可以通过以下方式获取所有损坏的链接: Sitecore.Data.Database db = Sitecore.Context.Database; Sitecore.Links.LinkDatabase linkDb = Sitecore.Globals
  • In Sitecore 8, how can I add a new application to the Start Menu?
    We're using Sitecore 8.1 and would like to add a new app to the Start Menu: How can one do so?
  • 在我的MVC解决方案中,Sitecore给出了一个空白页面,仅包含文本“默认页面”(Sitecore gives a blank page with just the text “Default page” in my MVC solution)
    问题 当我浏览至起始页面(例如/ sv)时,我得到一个空白页面,上面仅显示“默认页面”。 但是,当我尝试/ sv /时,它可以工作。 像/ sv / example这样的子页面也可以不加斜线工作。 我正在使用仅具有MVC视图的Sitecore 7.1。 回答1 从Web根目录中删除default.aspx文件。 那将解决您的问题。 回答2 当最后请求不带斜杠的URL时,preprocessRequest管道的“ StripLanguage”处理器会将路径重写为Settings.DefaultPageName设置的值(默认为“ default.aspx”)。 由于此类页面实际上存在于您的站点上,因此ASP.NET MVC路由系统不处理此类请求,并且文件本身已得到处理。 此行为由RouteCollection.RouteExistingFiles属性控制(默认情况下为false),有关详细信息,请参考以下文章:http://msdn.microsoft.com/zh-cn/library/system.web.routing.routecollection。 routeexistingfiles.aspx。 在其他情况下,当在语言之后添加斜杠时,则不会发生这种情况,因为“ StripLanguage”处理器不会重写路径(这也不是预期的行为)。 结果,请求URL与站点中的“
  • Sitecore 快速查询导致解析异常(Sitecore Fast Query Gives Parse Exception)
    问题 为什么我在下面的代码中收到此错误ParseException: End of string expected at position 4. 这是代码:错误在第三行。 var db = Sitecore.Configuration.Factory.GetDatabase("web"); string query = @"fast:/sitecore/content/foodservice/home/Products/3492-5326/3518-7"; Item item = db.SelectSingleItem(query); return item; 我们可以使用SelectSingleItem()进行快速查询吗? 我试图避免get folder contents and loop through each item until I find the target solution. 建议? 回答1 使用 Sitecore Query 时,您需要使用破折号对项目名称进行转义。 来自SDN: 名称中带有破折号(“-”)的项目应包含在“#”符号中。 请使用这样的语法:/sitecore/content/Home/#About-us#。 否则,您可能会收到以下错误:无效的查找源“/sitecore/content/TestSiteB/Home/About-us”:预期在位置
  • How to disable Sitecore Analytics entirely
    We are experiencing cpu problems on our production servers. After profiling with the jetbrains cpu profiler, we have noticed that some functions in the assembly Sitecore.Analytics were executed. This is somewhat strange because we have disabled all analytics related configuration in de config files. After looking into the /sitecore/admin/showconfig.aspx we noticed that there are still a lot of Sitecore.Analytics related configurations in this config while these are deactivated in our config files. For example In the file /App_Config/Include/EventHandlers.config the configuration looks like
  • 何时在 Sitecore 7 构建中绝对使用 SOLR 而不是 Lucene?(When to definitely use SOLR over Lucene in a Sitecore 7 build?)
    问题 我的客户没有预算来设置和维护 SOLR 服务器以在他们的生产环境中使用。 如果我正确理解了 Sitecore 7 Content Search API,那么配置事物以使用 Lucene 并不是什么大问题。 大多数情况下,配置将是相似的,代码将是相同的,以后可以换入 SOLR 服务器。 网站建设有 分面搜索页面在登陆和其他页面上列出将利用内容搜索 API 的组件具有自定义面的存储桶 该网站有大约 5,000 个页面和组件,不包括媒体库项目。 简单地使用 Lucene 是否有任何顾虑? 主要问题是,在您的架构或设计阶段,您何时知道应该选择 SOLR 而不是 Lucene? 导致您建议这样做的主要迹象是什么? 回答1 我认为,如果您要与预算有限的客户打交道,那么 Lucene 将工作得非常好,并且在您正在做的事情的规模上表现出色。 Lucene 中的实现完全支持您提到的所有内容。 在 Sitecore 场景中,如果出现以下情况,我会开始考虑 Solr: 您需要为大量项目建立索引——比如 5 万个以上——Lucene 对这些数字很满意,但 Solr 改进了查询缓存,专为这些大量项目而设计。 搜索层的弹性具有最大的业务重要性(即站点完全由搜索驱动)——Solr 通过 SolrCloud 提供了更强大的复制/分片和故障转移系统。 在其他应用程序中重新调整搜索层的用途很重要(非
  • Sitecore Search Predicate Builder multiple keyword search with boosting not working as desired
    I have sitecore pages / lucene documents with the following fields: Title Filename Content File Contents I'm creating a search for these and have the following requirements: Hits containing the whole phrase in the title field should be returned first. Hits containing the whole phrase in the filename field should be returned second. Hits containing the whole phrase in the content should be returned third Hits containing the whole phrase in the file contents should be returned fourth Hits containing all of the keywords (in any order) in the title field should be returned fifth Hits containing
  • Sitecore ContentSearch duplicate indexes when saving items
    I have implemented an index for our application which is supposed to index our items from an item bucket on the master database, but it seems that each time an item is updated and saved (not published, since the index works on master) an additional index is created for that item, which means another search result for the item. After regenerating the indexes there seems to be no issue, each item in the bucket is indexed exactly once. I'm adding the index config for the search functionality below: <configuration xmlns:patch="http://www.sitecore.net/xmlconfig/"> <sitecore> <customSearchNewsItem>
  • 使用无扩展名 URL 的优点是什么?(What are the pros for using extension-less URLs?)
    问题 使用无扩展 URL 的优点是什么? 例如,我为什么要改变... http://yoursite.com/mypage.html http://yoursite.com/mypage.php http://yoursite.com/mypage.aspx 至... http://yoursite.com/mypage 是否可以为每个页面提供无扩展名的 URL? 更新: 无扩展名的 URL 对站点安全性更好吗? 回答1 无扩展 URL 的原因是它与技术无关。 如果您想更改内容的呈现方式,则不必更改 URL。 W3:酷 URI 不会改变 文件扩展名这是一个很常见的。 “cgi”,甚至“.html”都会改变。 您可能在 20 年内不会在该页面上使用 HTML,但您可能希望今天指向它的链接仍然有效。 制作指向 W3C 站点的链接的规范方式不使用扩展名.... 结论保留 URI 使其在 2、20 或 200 年甚至 2000 年后仍然存在显然并不像听起来那么简单。 然而,在整个网络上,网站管理员都在做出决定,这将使他们在未来变得非常困难。 通常,这是因为他们使用的工具的任务是呈现当前最佳站点,而没有人评估过当事情发生变化时链接会发生什么。 然而,这里的信息是,很多事情都可以改变,而您的 URI 可以而且应该保持不变。 只有当您考虑如何设计它们时,它们才能做到。 回答2
  • Programmatically removing sublayouts in Sitecore
    Does anyone know how to remove the renderings from a Sitecore item? I want to remove all of the sublayouts so I can replace them with a new set. I have tried this but it does not seem to work. Nothing changes on the item. I appear to be able to get the renderings like this: RenderingReference[] renderings = item.Visualization.GetRenderings(Sitecore.Context.Device, true); But there appears to be no way to then set them. I can also get the renderings like this (from the link above): LayoutDefinition layoutDefinition = LayoutDefinition.Parse(LayoutField.GetFieldValue(item.Fields[Sitecore.FieldIDs
  • Sitecore Analytics: Trigger profiles and events from webservice
    I have a problem with Sitecore.Analytics From my xslt, I do an ajax call to a webservice using jQuery. In my webservice I need to register/save some Sitecore.Analytics data. The problem is that I can't use Sitecore.Analytics.AnalyticsTracker.Current. So how do I do TriggerProfile and TriggerEvent? I wonder if Sitecore.Analytics.AnalyticsManager could be to any help.
  • Updating Sitecore Social Profile into an external system
    We are using the Sitecore Social Connected Module version 3.0 with Sitecore 7.5. Everything is working fine, in the sense that we log the user in and see the profile information stored into MongoDb. However, there is a requirement to also store the profile information into a separate system. I've successfully been able to do this by tapping into the following social module events: <event name="social:connector:user:loggedin"> </event> <event name="social:connector:user:socialprofileattached"> </event> In those events, I utilize the following code to read MongoDb and attempt to update the
  • Sitecore Droptree won't exclude items
    I'm working on a Sitecore 8.1 installation. I'm trying to use a droptree field to allow content editors to pick one item (data template A) from a tree of items. Each item that's a valid selection is guaranteed to have one or more child items of a different data template (data template B). According to the documentation, this should be easy to do: just set the source to either a parameterized datasource: Datasource=/sitecore/Media Library/Images/Folder&IncludeTemplatesForDisplay=Data Template A or a query: query:/sitecore/Media Library/Images/Folder/*[@@templatename='Data Template A'] For some
  • Sitecore 6.5 DMS - Registering a goal completion via the API
    I want to register a goal/conversion on my Sitecore 6.5 site using the API rather than a 'thank-you' page. I've seen this question about how to do it Sitecore OMS - achieving a goal on a form submission but the answer relates to the API prior to Sitecore 6.5 where it was overhauled quite significantly. Has anyone done this? Or has this functionality been intentionally removed?