在Ubuntu上安装了MongoDb,表示未安装(Installed MongoDb on Ubuntu, says its not installed)
在Ubuntu上按照网站上的分步说明安装MongoDb http://docs.mongodb.org/manual/tutorial/install-mongodb-on-linux/当我尝试运行mongo时收到以下错误。 “程序'mongo'目前尚未安装。”
但它在目录中。
test@MongoDb1:~$ mkdir -p mongodb test@MongoDb1:~$ ls mongodb mongodb-linux-x86_64-2.5.4.tgz test@MongoDb1:~$ cp -R -n mongodb-linux-x86_64-2.5.4/ mongodb test@MongoDb1:~$ cd mongodb test@MongoDb1:~/mongodb$ ls mongodb-linux-x86_64-2.5.4 test@MongoDb1:~/mongodb$ cd mongodb-linux-x86_64-2.5.4/ test@MongoDb1:~/mongodb/mongodb-linux-x86_64-2.5.4$ ls bin GNU-AGPL-3.0 README THIRD-PARTY-NOTICES test@MongoDb1:~/mongodb/mongodb-linux-x86_64-2.5.4$ cd bin/ test@MongoDb1:~/mongodb/mongodb-linux-x86_64-2.5.4/bin$ ls bsondump mongodump mongoimport mongorestore mongotop mongo mongoexport mongooplog mongos mongod mongofiles mongoperf mongostat test@MongoDb1:~/mongodb/mongodb-linux-x86_64-2.5.4/bin$ mongo The program 'mongo' is currently not installed. You can install it by typing: sudo apt-get install mongodb-clients test@MongoDb1:~/mongodb/mongodb-linux-x86_64-2.5.4/bin$
Installed MongoDb on Ubuntu following the step by step instructions on the site http://docs.mongodb.org/manual/tutorial/install-mongodb-on-linux/ I receive the following error when I try and run mongo. "The program 'mongo' is currently not installed."
Yet it is in the directory.
test@MongoDb1:~$ mkdir -p mongodb test@MongoDb1:~$ ls mongodb mongodb-linux-x86_64-2.5.4.tgz test@MongoDb1:~$ cp -R -n mongodb-linux-x86_64-2.5.4/ mongodb test@MongoDb1:~$ cd mongodb test@MongoDb1:~/mongodb$ ls mongodb-linux-x86_64-2.5.4 test@MongoDb1:~/mongodb$ cd mongodb-linux-x86_64-2.5.4/ test@MongoDb1:~/mongodb/mongodb-linux-x86_64-2.5.4$ ls bin GNU-AGPL-3.0 README THIRD-PARTY-NOTICES test@MongoDb1:~/mongodb/mongodb-linux-x86_64-2.5.4$ cd bin/ test@MongoDb1:~/mongodb/mongodb-linux-x86_64-2.5.4/bin$ ls bsondump mongodump mongoimport mongorestore mongotop mongo mongoexport mongooplog mongos mongod mongofiles mongoperf mongostat test@MongoDb1:~/mongodb/mongodb-linux-x86_64-2.5.4/bin$ mongo The program 'mongo' is currently not installed. You can install it by typing: sudo apt-get install mongodb-clients test@MongoDb1:~/mongodb/mongodb-linux-x86_64-2.5.4/bin$
原文:https://stackoverflow.com/questions/20503366
最满意答案
由于您无法单独推送产品,因此您需要构建包含所有产品的对象。
- 第一步是检索已经在dataLayer中的对象(即使是空的)
- 得到产品对象
- 把新物品推进去
- 将整个对象推送到dataLayer
如果您遇到任何此类问题,请告诉我。
尝试首先使用以下方法定义dataLayer varible:
var dataLayer = window.dataLayer || [];
它将采用现有的dataLayer变量并添加使用它,如果没有,它将为它创建数组。
另外,我可以看到你使用的是小写“datalayer”。 它应该是“dataLayer”。
我希望这将有所帮助。
I turns out google tag manager rewired
dataLayer.push()
method to fire events and guard the dataLayer's size. A side effect is that it does not operate as expected. The way to overcome this issue was to push all the scraped product data into a javascript variable and once it was ready, to push that variable into thedataLayer
as follows:function scrape2DL() { dataLayer.push({'ecommerce.checkout.actionField': {step: 2}}); //action object var base = 0; var products=[]; while (base < $('div.field_cart').length/4) { products.push([{id: $('div.field_cart')[4 * base + 0].innerText, price: $('div.field_cart')[4 * base + 1].innerText.match(/[0-9]+/), quantity: $('div.field_cart')[4 * base + 2].innerText}]); base += 1; }//while dataLayer.push({'ecommerce.checkout.products': products}); // add a product } scrape2DL(); dataLayer.push({event: 'checkout'}); // for GTM triggers
However it turns out that it is possible to fetch the products from the datalayer into a javascript variable using the datalayer get method and subsequently append more products into it. However I ultimately avoided this aproach as it skips the event and size guard check wired into
dataLayer.push()
.The folowing resources were of some help:
- SO question titled Console returns value but Google Tag Manager variable does not
- Google Tag Manager For Nerds by Simo Ahava.
相关问答
更多-
TCP/IP模型是一个________。[2023-05-19]
a -
您需要创建3个变量类型的自定义JavaScript函数,它从dataLayer中选择所需的值并将其返回到数组中。 就像是 function(){ var products = {{transactionProducts}}; var skuArray = []; for(i = 0; i < products.length; i++) { if(products[i].sku){ skuArray.push(products[i].sku) } } return skuAr ...
-
GTM - 自定义电子商务标签(GTM - Custom Ecommerce tag)[2022-06-28]
我对非标准数据层所做的是创建一个带有javascript函数的自定义html标记,该函数将数据损坏为正确的形式。 然后,我将转换后的数据和自定义事件推送到数据层,并在自定义事件上触发了事务跟踪。 这样你可以使用UA标签和GTM,这将为你节省很多问题。 但是,可能已经帮助您的是转到属性设置并将支付提供商的域添加到referall排除列表。 似乎没有涉及实际的跨域跟踪(付款可能在另一个域上发生,但您确实没有代码)并且目前应该可以混合经典代码/ Universal Analytics,只要它们不在同一个页。 然而 ... -
在Google跟踪代码管理器中,您需要设置以下内容: 代码类型: Universal Analytics(Google Analytics)跟踪类型:屏幕视图 字段名称: screenName值:[我在下面标识的变量] 触发: “事件名称”上的触发包含屏幕 **注意触发器可能比匹配“screen_view”更好,但我没有机会测试 变量: Variable Type = Event Parameter Event Type = Custom Parameter Event Parameter Key = ...
-
在GTM的数据层中使用时,Javascript变量未定义(Javascript variable undefined when used in data layer in GTM)[2023-10-17]
尝试两次后解决了这个问题。 首先,在搜索后,我发现这是一个Javascript异步问题。dataLayer在收到Rest call响应之前获取变量,因此该变量在dataLayer中不可用(在时间之前被检索到),并且可用于为了排序,dataLayer必须在成功接收响应后构建。因此,在成功接收响应之后调用了一个包含dataLayer的callback函数 AUI().ready('aui-base', function(A){ Liferay.Service( '/user/get-user-by ... -
GTM + Analytic mobile(GTM + Analytic mobile)[2023-02-07]
您是否在要设置的字段中提供screenName? Universal Analytics代码需要screenName才能跟踪appView类型。 Are you supplying a screenName in fields to set? Universal Analytics tags require a screenName for tracking types appView. -
由于您无法单独推送产品,因此您需要构建包含所有产品的对象。 第一步是检索已经在dataLayer中的对象(即使是空的) 得到产品对象 把新物品推进去 将整个对象推送到dataLayer 如果您遇到任何此类问题,请告诉我。 尝试首先使用以下方法定义dataLayer varible: var dataLayer = window.dataLayer || []; 它将采用现有的dataLayer变量并添加使用它,如果没有,它将为它创建数组。 另外,我可以看到你使用的是小写“datalayer”。 它应该是“d ...
-
回答Q1: GTM正在这样做,因为这是DataLayer按预期的行为: https : //github.com/google/data-layer-helper 回答Q2: 由Brian Kuhm本人(GTM背后的男人:)提供 ,如果你想阻止递归合并,你需要先发送一个空值,然后推送你的实际对象。 我创建了一个包装器来做到这一点: window.dataLayer = window.dataLayer || []; window.dataTrack = function(obj) { dataLayer ...
-
GTM中的数据层属性(Data Layer Properties in GTM)[2023-07-29]
转到变量部分,单击new,选择“datalayer variable”(datalayer版本默认为版本2,不要更改),输入要提取值的datalayer键(即eventLabel),然后给该变量命名 - 我通常使用dataLayer键作为名称,因此很明显变量包含什么。 然后在标签字段中输入新创建的变量(通过单击字段后面的符号并从列表中选择,或在{{double curly brackets}}中输入变量名称)。 Go to the variables section, click new, select " ... -
假设你正在使用上面的确切代码,那么你会遇到一些语法错误。 你不需要用引号来包装GTM变量 不要使用parseInt,因为它只返回一个整数。 请改用“数字”。 你遗漏了一个括号 所以你应该使用这样的东西: function(){ var total = 0; $({{product price}}).each(function(){ total += Number(this); }) return total; } I don't know if it is normal ...