从跟踪脚本返回值

时间:2020-01-24 09:33:24

标签: javascript key

我的网站上加载了以下跟踪脚本。我想出于GTM目的返回“ checkout_date”值。该功能将通过GTM运行。

一旦我可以执行正确的返回功能js。我尝试了一些在这里找到的东西,但是所有这些似乎都需要“ var name =“,我在任何地方都看不到。”

例如,我尝试以下操作均未成功:

function (for(checkout_date in window.hTaxis.criteoBasketTag)) {
    if(window.hTaxis.criteoBasketTag.hasOwnProperty(checkout_date)) {
        return "checkout_date" = data[checkout_date];
        //do something with value;
    }
}
<script type="text/javascript">

    window.hTaxis = window.hTaxis || {};
    window.criteo_q = window.criteo_q || [];

    window.criteo_q.push(
        { event: "setAccount", account: 31165 },
        { event: "setSiteType", type: window.hTaxis.siteType },
        { event: "setHashedEmail", email: "" },
        { event: "viewItem", item: 1016454 },
        {
            event: "viewSearch",
            checkin_date: "2020-01-31",
            checkout_date: "2020-02-07"
        }
    );

    window.hTaxis.criteoBasketTag = [
        {event: "setAccount", account: 31165},
        {event: "setSiteType", type: window.hTaxis.siteType},
        {event: "setHashedEmail", email: ""},
        {
            event: "viewBasket", item: [
                {
                    id: 1016454,
                    price: 39.64,
                    quantity: 1
                }
            ]
        },
        {
            event: "viewSearch",
            checkin_date: "2020-01-31",
            checkout_date: "2020-02-07"
        }
    ];
</script>

0 个答案:

没有答案