Search code examples
c#uwpgoogle-analyticsgoogle-analytics-apigoogle-analytics-sdk

How to do Google Tag manager integration for UWP application


I am trying to integrate Google tag manager with a simple UWP application,To achieve this I am using SDKforGoogleAnalytics library (This is the only library i can find in entire internet which does this job). Using this library I am able to send pageviews to Google and get back a success response. But in real google analytics dashbord this pageviews are never logged. an anyone point out what can be going wrong here? or is there any other way to integrate Google analytics with UWP? My sample Request

  v:1
tid:UA-12345678-1
cid:xxxxxx-xxxx-xxxx-xxxx-xxxxxxxxx
an:xxxxxx-xxxx-xxx-xxxx-xxxxxxxxx
av:1.0.0.0
cd:Main
sr:1366x768
vp:1366x696
ul:en-US
t:screenview

Response

    {
  "hitParsingResult": [ {
    "valid": true,
    "parserMessage": [ ],
    "hit": "/debug/collect?v=1\u0026tid=UA-12345678-1\u0026cid=b91b73fb-xxxxx-xxxx-xxxx-xxxxxxxxx\u0026an=2ec26bec-xxxx-xxxx-ab91-da6243a8c6aa\u0026av=1.0.0.0\u0026cd=Main\u0026sr=1366x768\u0026vp=1366x696\u0026ul=en-US\u0026t=screenview"
  } ],
  "parserMessage": [ {
    "messageType": "INFO",
    "description": "Found 1 hit in the request."
  } ]
}

Solution

  • You have to track pageview instead sceenview. Mobile tracking with Universal Analytics has been deprecated so if you want to use measurement protocol use t=pageview and relative required parameters (like location).