因此,我必须使用JavaScript确定专有CRM中的页面类型.确定页面类型(即前端唯一一致的差异)的唯一方法是检查src属性以/ modules /开头的脚本标记(在许多列表中).
在标题中的十几个脚本标记的列表中,每个页面都有以下格式的行
<script src="/modules/example/includes/sample.js" type="text/javascript"></script>
Run Code Online (Sandbox Code Playgroud)
现在,脚本标记的顺序永远不会相同,但是,总有一个脚本具有/ modules/blah.我需要提取blah到我的脚本可以检测它是什么样的页面.
那么,我如何使用JavaScript或jQuery提取脚本标记的src值,其中src以/ modules开头,然后将值('示例',在上面的示例中)存储为javascript变量?
我想知道是否有办法创建由SVN提交触发的脚本,并在谷歌分析配置文件中添加注释?
如果Web应用程序发生变化,这将会很方便,最终会对应用程序的分析产生影响.
我有一个数据库,我查询,我不确定在哪里执行结果的排序,到目前为止,我有以下选项.
List由ObjectDTO组成,因此它会更有效率.有任何想法吗?
我想通过Facebook社交插件(iframe小部件)将谷歌分析中的事件跟踪应用到我们网站上的Facebook评论,但我似乎无法找到附加事件的方法.我更愿意,如果解决方案是基于jquery,但我很乐意接受大多数建议.
javascript jquery facebook google-analytics facebook-javascript-sdk
任何人都可以分享谷歌anlytics代码疑难解答的最佳做法吗?
有人建立了调试工具吗?谷歌有隐藏的地方吗?有人有一个很好的分类逻辑图吗?
我会定期设置GA的不同部分,似乎每次我都需要4到5天才能使它工作.
工作流程如下所示:
Read the docs on the feature (e.g. events, custom variables).
Implement what appears to be the correct code based on the docs.
Wait a day.
See no data.
Google every version of the problem I can imagine. Find what may be a solution.
Change my code.
Wait a day.
See no data.
Loop:
Randomly move elements of the tracking code around.
Wait a day.
If other parts break, tell ceo, get yelled at, revert changes.
If …
Run Code Online (Sandbox Code Playgroud) 我正在创建一个拖放插件,我想让它有点独特我会添加一个cookie功能来保存拖动元素的位置.
我目前正在使用以下代码来获取和设置cookie:
$.setCookie = function(c_name, value, exdays) {
var exdate = new Date();
exdate.setDate(exdate.getDate() + exdays);
var c_value = escape(value) + ((exdays == null) ? "" : "; expires=" + exdate.toUTCString());
document.cookie = c_name + "=" + c_value;
}
$.getCookie = function(c_name) {
var i, x, y, ARRcookies = document.cookie.split(";");
for (i = 0; i < ARRcookies.length; i++) {
x = ARRcookies[i].substr(0, ARRcookies[i].indexOf("="));
y = ARRcookies[i].substr(ARRcookies[i].indexOf("=") + 1);
x = x.replace(/^\s+|\s+$/g, "");
if (x == c_name) {
return unescape(y);
} …
Run Code Online (Sandbox Code Playgroud) 我正在尝试用Python编写数据库抽象层,它允许您使用链式函数调用来构造SQL语句,例如:
results = db.search("book")
.author("J. K. Rowling")
.price("<40.00")
.title("Harry")
.execute()
Run Code Online (Sandbox Code Playgroud)
但是当我尝试将所需方法动态添加到db类时,我遇到了问题.
以下是我的代码的重要部分:
import inspect
def myName():
return inspect.stack()[1][3]
class Search():
def __init__(self, family):
self.family = family
self.options = ['price', 'name', 'author', 'genre']
#self.options is generated based on family, but this is an example
for opt in self.options:
self.__dict__[opt] = self.__Set__
self.conditions = {}
def __Set__(self, value):
self.conditions[myName()] = value
return self
def execute(self):
return self.conditions
Run Code Online (Sandbox Code Playgroud)
但是,当我运行例如:
print(db.search("book").price(">4.00").execute())
Run Code Online (Sandbox Code Playgroud)
输出:
{'__Set__': 'harry'}
Run Code Online (Sandbox Code Playgroud)
我是以错误的方式来做这件事的吗?有没有更好的方法来获取被调用函数的名称或以某种方式制作函数的"硬拷贝"?
我想知道如何使用Google Analytics(可能使用api)创建图表,但我不确定是否已经有关于如何执行此操作的插件或教程.Google.com上的Javascript API参考很糟糕.
此外,任何有关如何创建折线图(画布元素?)的参考也会很棒.
谢谢!
用户在"example-one.com"上填写"新"用户表单后,"创建"控制器会在数据库中创建记录.然后它执行redirect_to到外部站点"payment-checkout.com".我在两个网站上都设置了Google Analytics代码.
Google提供了两个函数_link和_linkByPost,可用于转发到外部域的任何链接或表单.问题是用户被视图外的控制器操作重定向,我不能使用这两个javascript函数传递相关的GA信息 - 我该怎么办?
有人可以帮忙吗?
我正在使用require.js(http://requirejs.org/)来访问我网站上的许多功能,到目前为止它似乎运行良好.在尝试包含Google Analytics代码时,我遇到了一个问题.该代码似乎拒绝添加utm.gif,并且没有向Google发送信标.我想知道这是不是范围的事情.
define(function() {
var Analytics = {};
Analytics.Apply = function() {
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-XXXXX-X']);
_gaq.push(['_trackPageview']);
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
}
return Analytics;
});
Run Code Online (Sandbox Code Playgroud)
ga.debug不会抛出任何错误,并且不会出现utm.gif.如果我将代码移到require.js之外(我的意思是模块化的javascript使用require.js,所以只需将其内联添加到页面中),utm.gif就会成功添加到页面中,ga.debug会发送它的信标.
我发现这个网站似乎成功使用它,但我不确定该网站的用途是什么:http://paceyourself.net/2011/05/14/managing-client-side-javascript-with-requirejs /
还有其他人遇到过将require.js和GA结合起来的问题吗?