我在我的特定网站上使用应用程序HotJar.现在这个应用程序记录会话(鼠标移动和一切的完整录制).可以选择"自动标记"录音,以便通过搜索特定标签在我的库中找到一些录音.
我写了一个小脚本,应该标记来自特定来源的访问.它看起来像这样:
<script>
$(document).ready(function() {
if (document.location.indexOf('?utm_source=Bing') > -1 ) {
hj('tagRecording', ['Bing_source']);
}
if (document.location.indexOf('?gclid=') > -1 ) {
hj('tagRecording', ['AdWords_source']);
}
if (document.location.indexOf('?utm_source=YouTube') > -1 ) {
hj('tagRecording', ['YouTube_source']);
}
if (document.location.indexOf('?u=') > -1 ) {
hj('tagRecordings', ['Mailchimp_source'])
}
});
</script>
Run Code Online (Sandbox Code Playgroud)
问题是,我收到以下错误:
Uncaught TypeError: document.location.indexOf is not a function
Run Code Online (Sandbox Code Playgroud)
我可能会遗忘一些东西但是当在stackoverflow上搜索时,这个函数变成了一个工作函数.
有没有人有想法?