Search code examples
c#google-analyticsgoogle-apigoogle-analytics-api

How to create Tracking code for webproperty of GA programmatically


How to get the Tracking code of the web property inserted to the Google Analytics Programmatically(c#).If we add the property to the GA manually then we can get the tracking code by clicking on "Get Tracking id". But I'm creating the property using c#. But I'm not getting How to get the Tracking Id.


Solution

  • If you are creating the account and web property programmaticly then the response web property response from property insert contains an id field which is the tracking id.

    id string Web property ID of the form UA-XXXXX-YY.

    As for the full javascript snippit. That is not returned by the API your going to have to create that yourself.