使用 Google 跟踪电子商务
我被要求将 Google 电子商务跟踪添加到我的网站中。 此跟踪涉及在收据页面上插入一些 JavaScript,然后调用它的函数。 在我的 asp.net 收据页面中,我需要为交易信息调用一个函数 (_addTrans),然后为订单上的每一项调用另一个函数 (_addItem)。 是他们想要的示例
此处 对于 1.1 站点。 有人可以帮助我从我的 C# 代码隐藏中调用这两个函数吗? 我无法想象只有我一个人需要致电谷歌电子商务跟踪,所以我充满希望。
I've been asked to add Google e-commerce tracking into my site. This tracking involves inserting some javascript on your receipt page and then calling it's functions. From my asp.net receipt page, I need to call one function (_addTrans) for the transaction info and then another (_addItem) for each item on the order. An example of what they want is here
This is for a 1.1 site. Can anybody give me a jumpstart on calling these two functions from my c# code-behind? I can't imagine that I'm alone out there in needing to call Google e-commerce tracking, so I'm hopeful.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
也许最简单的方法是将所需的 Javascript 构建为字符串,
然后将其注册为出现在页面中:
Probably the easiest way is to build up the required Javascript as a string with something like
Then register it to appear in the page with
在这里,我刚刚编写了一个 Google Analytics 电子商务类来动态添加分析交易。
http://www.sarin。 mobi/2008/11/generate-google-analytics-e-commerce-code-from-c/
希望这个希望。
Here i just wrote an Google Analytics E-Commerce class to dynamically add analytics transactions.
http://www.sarin.mobi/2008/11/generate-google-analytics-e-commerce-code-from-c/
Hope this hope.
响应 stevemegson(第一个答案) - pageTracker._addItem 方法的第一个参数不应该是 OrderID,而不是 itemNumber 吗?
In response to stevemegson (first answer) - shouldn't the first parameter into the pageTracker._addItem method be the OrderID, not the itemNumber?
我发布的一个项目允许与 Google Analytics 轻松集成,以通过本机 .net 代码触发页面视图和事件。
这样,您只需调用一个方法即可为您记录事件或页面视图。
我计划在接下来的几周内支持事务日志记录。
它称为 GaDotNet,可以在这里找到: http://www.diaryofaninja.com /projects/details/ga-dot-net
A project i have released allows for easy integration with Google Analytics to fire page views and events through native .net code.
This way you can simply call a method that will log either and event or a page view for you.
I am planning on supporting transaction logging as well over the next few weeks.
It's called GaDotNet and can be found here: http://www.diaryofaninja.com/projects/details/ga-dot-net