How to track Custom variables in google analytics. RRS feed

  • Question

  • User-2055169795 posted

    I am using google analytics for tracking the activity user perform on my site.
    I want to add some custom variables to get the precise report. I am using below code to create a custom variable in my javascript.

    var _gaq= _gaq || [];
    _gaq.push(["_setCustomVar", 1, "Category", "categoryName", 3]);

    I also added analytics JS

    <!-- Google Analytics -->
    window.ga=window.ga||function(){(ga.q=ga.q||[]).push(arguments)};ga.l=+new Date;
    ga('create', 'UA-XXXXX-Y', 'auto');
    ga('send', 'pageview');
    <script async src='https://www.google-analytics.com/analytics.js'></script>
    <!-- End Google Analytics --> 

    now, how can I track this custom variable in google analytics? how can I check, is this above code creating any custom variable or not?

    Tuesday, January 8, 2019 10:32 AM

All replies

  • User-893317190 posted

    Hi ashwin.barfa,

    You could customize your variable through  Custom Dimensions and Metrics.

    Please configure  in your admin dashboard first and then write your code.

    Refer to https://stackoverflow.com/questions/16440499/how-to-set-custom-variables-through-the-new-analytics-js-of-ga

    Best regards,

    Ackerly Xu

    Wednesday, January 9, 2019 2:10 AM
  • User934794397 posted

    From conceptual design to product release, the highest quality standards are maintained at every stage of the development process. So for that, you need a great engineers team and extensive communication facilities that allow you to make it faster! So I can recommend to you contact with Axonim that made for me hardware development.

    Sunday, December 20, 2020 9:55 PM