Send info to google tag manager from backend

孤者浪人 提交于 2019-12-12 05:19:33

问题


Working on a website, I use Google Tag Manager and push some info with the dataLayer in Javascript. So far so good. However there are some information that should not be seen on the client side. Therefore I'm wondering if it's possible to do the same thing on the backend?

Basically a request to GTM API that does the equivalent of

dataLayer.push({
    'event': 'transaction',
    'something': {
        'superSecret': 42
    }
});

but on backend. (I've never used GTM API and I'm not sure if it permits to do this kind of requests. If possible, I would appreciate some help :) ). Thanks!


回答1:


GTM for the Web is basically a Javascript injector - the Interface is there to configure your tags, then everything is wrapped into a JavaScript function that is inserted into your page and executed by the browser. There is no serverside component that you could push data to.

So quite probably the answer is no (unless you want to try really weird workarounds like running the container in a headless browser on your server or trying to abuse the mobile SDKs for GTM, which works rather differently than the web version). I guess it would be easier to send your serverside calls directly to the respective tracking services.



来源:https://stackoverflow.com/questions/39774009/send-info-to-google-tag-manager-from-backend

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!