简体   繁体   中英

Google Tag Manager server side tracking .NET

We need to push datalayer, trigger events and so on from .Net (C#) application from server side .

Google Tag Manager has JavaScript, Android and iOS SDKs. Also it has REST API, but this API allows only to manage containers, tags and events, but doesn't allow to track them.

So is it possible implement server side tracking for GTM? Seems it should be as there is SDKs for mobiles exist and it should be no big difference.

If it is possible then please let us know how and maybe there is API exists for that or SDK for .Net exists or planned in future. Maybe we have to push our data directly to Google Analytics and other endpoints? As I can see JavaScript SDK pushs data directly to GA from page.

Some clarifications first: GTM = Client Side
GTM is not a tracking tool (although it can be used to facilitate the implementation of actual tracking tools), it is a Tag Management system. That is why it only runs on the client side (Browser JavaScript, Android/iOS SDKs are all client-side runtime environments). The REST API you are referring to is a management API to automate tasks you would normally perform manually via the GTM GUI, it doesn't change the way GTM works (that is, a client-side tool).

Using server-side code with GTM
There are several ways you can write server-side code to interact with GTM, but it ultimately has to result in some code being evaluated on the client-slide . Some examples:

  • Variables : you can create JavaScript variables via .NET which you then read on the client-side (or you can create dataLayer code directly following the same method)
  • AJAX calls : you can use the client to make AJAX calls to your server, and use the server response to trigger events, create variables, and tags.
  • Web socket : you can use a socket to push notifications from your server and once again use those to trigger event, create variables, and tags.

But once again, no matter what you do on the server-side, it must systematically lead to 1 thing: code to be evaluated on the client-side.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM