zoukankan      html  css  js  c++  java
  • Google Analytics

    Google Analytics

    Google Analytics is one of the most popular digital analytics software. It is Google's free web analytics service that allows you to analyze in-depth detail about the visitors on your website. It provides valuable insights that can help you to shape the success strategy of your business.

    Google Analytics for Beginners

    How analytics.js Works

    Almost everything you need to measure with analytics.js can be done using the ga() command queue. This guide explains what the command queue is, how it works, and how to execute commands to measure user interactions.

    Adding commands to the queue

    All calls to the ga() command queue share a common signature. The first parameter, the "command", is a string that identifies a particular analytics.js method. Any additional parameters are the arguments that get passed to that method.

    The method a particular command refers to can be a global method, like create, a method on the ga object, or it can be an instance method on a tracker object, like send. If the ga() command queue receives a command it doesn't recognize, it simply ignores it, making calls to the ga() function very safe, as they will almost never result in an error.

    For a comprehensive list of all commands that can be executed via the command queue, see the ga() command queue reference.

    ga.create

    Creates a new tracker instance with the specified fields.

    ga.create([trackingId], [cookieDomain], [name], [fieldsObject]);

    Note: it's recommended to call the create method via the ga command queue. See the create method reference for more details.

    https://developers.google.com/analytics/devguides/collection/analyticsjs/ga-object-methods-reference#create

    https://developers.google.com/analytics/devguides/collection/analyticsjs/command-queue-reference#create

    send

    Sends a hit to Google Analytics.

    Usage

    ga('[trackerName.]send', [hitType], [...fields], [fieldsObject]);
     The type of hit. Must be one of 'pageview', 'screenview', 'event', 'transaction', 'item', 'social', 'exception', 'timing'.

    The fields that are sent are the values specified in the ...fields parameters and fieldsObject, merged with the fields currently stored on the tracker.

    Note: the values specified in ...fields and fieldsObject are sent with the current hit, but they are not stored on the tracker object. Use the set method to update a tracker. 

    <script>
        (function (i, s, o, g, r, a, m) {
        i['GoogleAnalyticsObject'] = r; i[r] = i[r] || function () {
            (i[r].q = i[r].q || []).push(arguments)
        }, i[r].l = 1 * new Date(); a = s.createElement(o),
            m = s.getElementsByTagName(o)[0]; a.async = 1; a.src = g; m.parentNode.insertBefore(a, m)
        })(window, document, 'script', 'https://www.google-analytics.com/analytics.js', 'ga');
    
        ga('create', '@System.Configuration.ConfigurationManager.AppSettings["GoogleAnalyticsID"]', 'auto');
        ga('send', 'pageview');
    </script>
  • 相关阅读:
    js三种存储方式区别
    利用split方法计算字符串中出现字母最多的次数
    图片预加载的三个方法
    页面有大量图片,优化图片的加载方法
    USB通信协议——深入理解
    C/C++回调函数
    显卡工作原理
    include包含头文件的语句中,双引号和尖括号的区别是什么?
    华为2015校园招聘 上机试题
    位操作基础篇之位操作全面总结
  • 原文地址:https://www.cnblogs.com/chucklu/p/12652055.html
Copyright © 2011-2022 走看看