跟踪脚本动态包含在asp.net页面中 [英] Tracking scripts dynamic inclusion in asp.net page

查看:84
本文介绍了跟踪脚本动态包含在asp.net页面中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们正在使用ASP.NET / C#(使用MVP)构建一个网站,该网站需要设计用于将跟踪脚本放置在页面中(如谷歌分析)。现在这些脚本可能是静态的(例如跟踪用户访问)或动态的(例如跟踪电子商务
数据,如订单总数等)。现在需要在哪个页面中放置哪些脚本以及要传递的信息的性质(动态或静态)的要求是客户希望能够独立控制的,因为这主要是
基于他们的营销团队需要。我们正在尝试提出一种解决方案,使我们能够使用一些配置文件或数据库设置在asp.net页面/视图中动态注入脚本,以便每个新脚本添加或修改都应该
不需要重建/重新部署。提出这种设计的另一个目的是实现页面逻辑和跟踪脚本嵌入之间的解耦。有没有人有任何类似的工作经验?在正确的方向寻找一些指示


Soumya

解决方案

如果我正确理解您的要求,新的捆绑和缩小是适合您的。


您可以包含特定文件夹中的所有脚本。


因此,客户可以选择(可能通过您编写的屏幕)哪些脚本放在哪些文件夹中。


这就是运行时提供的内容。


你如果您的要求不太合适,也可以覆盖某些方法并执行逻辑。


http://weblogs.asp.net/scottgu/archive/2011/11/27/new-捆绑和缩小支持-asp-net-4-5-series.aspx


(请将我的帖子标记为答案,如果确实如此,请将其标记为帮助。)


We are building a web site using ASP.NET/C#(using MVP) which needs to be designed for enabling tracking scripts to be placed in the pages(like google analytics). Now these scripts might be static(eg. tracking user visits) or dynamic(eg. tracking e-commerce data like order total, etc.). Now the requirements in terms of which script needs to be placed in which page and the nature of information to be passed(dynamic or static) is something that the client wants to be able to independently control as this is primarily based on their marketing team needs. We are trying to come up with a solution that enables us to dynamically inject the scripts in the asp.net pages/views using some config files or database settings so that every new script addition or modification should not require a rebuild/redeploy. Another intention behind coming up with this design is to enable decoupling between the page logic and the tracking scripts embedding. Has anyone had any prior experience of working with something similar? Looking for some pointers in the right direction.


Soumya

解决方案

If I understand your requirements correctly, the new bundling and minification is the stuff for you.

You can include all the scripts from a particular folder.

So the customer could choose ( perhaps via a screen you write ) which scripts go in what folders.

That's what's delivered at run time.

You can also over-ride certain methods and do logic if your requirement doesn't quite fit.

http://weblogs.asp.net/scottgu/archive/2011/11/27/new-bundling-and-minification-support-asp-net-4-5-series.aspx

( Please mark my post as answer and or helping if it does. )


这篇关于跟踪脚本动态包含在asp.net页面中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆