0

Iam using Google Tag manager==GTM as well as Visual Website Optimizer==VWO. All the script tags for both application are implemented accordingly.

In order to be able to track revenue we have to save the transactionTotal of an order into a variable that VWO uses to count the conversion rates on a specific test. The VWO clicks and visits are counted correctly but not the conversion.

I have created a macro in GTM ({transactionTotal}) based on fetching the data.

  1. First I get all the meta tags where we have the ecommerce values.

    var metaObj = {}, m = document.getElementsByTagName('meta'), i = m.length; //scope expanded from only .head while (i--) { // looping down will result in the same behaviour as stopping @ 1st metaObj[m[i].name] = m[i].content; }
  2. Then push the meta value in the dataLayer

    dataLayer.push({'transactionId': metaObj['WT.tx_i']});

  3. In GTM I created a macro GTM macro

  4. in the confirmation page:

    //should be the value of the order total var _vis_opt_revenue = ({transactionTotal});

This returns an error and no value is save in this variable.

Any ideas or help is much appreciated.

4

2 回答 2

0

我发现我有一个语法错误用户括号而不是大括号

所以应该是

var _vis_opt_revenue = {{transactionTotal}}; 

代替

var _vis_opt_revenue = ({transactionTotal});

于 2013-07-04T16:03:14.597 回答
0

你能缩进你的代码吗?这会容易得多。

其次,您使用一个正在寻找 transactionTotal 的宏,并且您在 dataLayer 上推送一个名为 transactionId 的对象因此,它无法工作

于 2015-04-21T12:08:05.040 回答