Google Tag Manager - firing events from rest api

痞子三分冷 提交于 2019-12-11 05:57:03

问题


Some of my events are getting fired from frontend for both google analytics and facebook pixel and they are getting captured properly through GTM.

but now i have a functionality which is getting done from cron and is served from backend. I need to capture a event in both google analytics and facebook pixel when this is getting captured.

We need to fire the https (rest based) calls for capturing this.

Kindly help on this how this can be achieved.


回答1:


GTM has no serverside API to trigger tracking calls (the GTM API is for managing tags that will be wrapped into a Javascript function. There is no tracking backend to do calls against).

You need to send your calls directly to GA via the measurement protocol or respectively to Facebook via offline conversions.




回答2:


Yes you can. create an event listener on button click to connect to the API to collect the data

then with an event push the data you want to a Datalayer

and then use it as you wish.



来源:https://stackoverflow.com/questions/50852843/google-tag-manager-firing-events-from-rest-api

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