1*61c4878aSAndroid Build Coastguard Worker.. _module-pw_cli_analytics: 2*61c4878aSAndroid Build Coastguard Worker 3*61c4878aSAndroid Build Coastguard Worker---------------- 4*61c4878aSAndroid Build Coastguard Workerpw_cli_analytics 5*61c4878aSAndroid Build Coastguard Worker---------------- 6*61c4878aSAndroid Build Coastguard WorkerThis module collects and transmits analytics on usage of the ``pw`` command line 7*61c4878aSAndroid Build Coastguard Workerinterface. This will help the Pigweed team improve its command line utilities. 8*61c4878aSAndroid Build Coastguard WorkerBy default this will be enabled, but it can be disabled on a per-project, 9*61c4878aSAndroid Build Coastguard Workerper-user, or per-project/per-user basis. Individuals can completely opt-out by 10*61c4878aSAndroid Build Coastguard Workerrunning ``pw cli-analytics --opt-out``, and can opt-in by running 11*61c4878aSAndroid Build Coastguard Worker``pw cli-analytics --opt-in``. 12*61c4878aSAndroid Build Coastguard Worker 13*61c4878aSAndroid Build Coastguard WorkerAnalytics 14*61c4878aSAndroid Build Coastguard Worker========= 15*61c4878aSAndroid Build Coastguard WorkerPigweed collects analytics on the use of the ``pw`` command. For projects using 16*61c4878aSAndroid Build Coastguard WorkerPigweed the default is to just collect details about the host machine 17*61c4878aSAndroid Build Coastguard Worker(operating system, CPU architecture, and CPU core count), but no data about the 18*61c4878aSAndroid Build Coastguard Workerexact command run or the project in question. This can be disabled by setting 19*61c4878aSAndroid Build Coastguard Worker``enabled`` to false in the files listed below. The default values for all the 20*61c4878aSAndroid Build Coastguard Workerproject-specific analytics options are below. 21*61c4878aSAndroid Build Coastguard Worker 22*61c4878aSAndroid Build Coastguard WorkerFor development on Pigweed itself, these options are all specifically enabled. 23*61c4878aSAndroid Build Coastguard Worker 24*61c4878aSAndroid Build Coastguard Worker``debug_url`` 25*61c4878aSAndroid Build Coastguard Worker Google Analytics URL to use when debugging. Defaults to 26*61c4878aSAndroid Build Coastguard Worker https://www.google-analytics.com/debug/mp/collect. 27*61c4878aSAndroid Build Coastguard Worker 28*61c4878aSAndroid Build Coastguard Worker``prod_url`` 29*61c4878aSAndroid Build Coastguard Worker Google Analytics URL to use in production. Defaults to 30*61c4878aSAndroid Build Coastguard Worker https://www.google-analytics.com/mp/collect. 31*61c4878aSAndroid Build Coastguard Worker 32*61c4878aSAndroid Build Coastguard Worker``report_command_line`` 33*61c4878aSAndroid Build Coastguard Worker If ``true``, the report will include the full command line with all arguments. 34*61c4878aSAndroid Build Coastguard Worker The home directory and any references to the username will be masked. 35*61c4878aSAndroid Build Coastguard Worker 36*61c4878aSAndroid Build Coastguard Worker``report_project_name`` 37*61c4878aSAndroid Build Coastguard Worker If ``true``, the ``root_variable`` entry from ``pigweed.json`` will be 38*61c4878aSAndroid Build Coastguard Worker reported. This is the name of the root variable, not its value. 39*61c4878aSAndroid Build Coastguard Worker 40*61c4878aSAndroid Build Coastguard Worker``report_remote_url`` 41*61c4878aSAndroid Build Coastguard Worker If ``true``, the remote URL will be reported. 42*61c4878aSAndroid Build Coastguard Worker 43*61c4878aSAndroid Build Coastguard Worker``report_subcommand_name`` 44*61c4878aSAndroid Build Coastguard Worker ``never`` 45*61c4878aSAndroid Build Coastguard Worker The subcommand name will not be reported. 46*61c4878aSAndroid Build Coastguard Worker 47*61c4878aSAndroid Build Coastguard Worker ``limited`` 48*61c4878aSAndroid Build Coastguard Worker The subcommand name will be reported if and only if it's one of the 49*61c4878aSAndroid Build Coastguard Worker subcommands defined in Pigweed itself. These are ``analytics``, ``bloat``, 50*61c4878aSAndroid Build Coastguard Worker ``build``, ``console``, ``doctor``, ``emu``, ``format``, ``heap-viewer``, 51*61c4878aSAndroid Build Coastguard Worker ``help``, ``ide``, ``keep-sorted``, ``logdemo``, ``module``, ``package``, 52*61c4878aSAndroid Build Coastguard Worker ``presubmit``, ``python-packages``, ``requires``, ``rpc``, ``test``, 53*61c4878aSAndroid Build Coastguard Worker ``update``, and ``watch``. 54*61c4878aSAndroid Build Coastguard Worker 55*61c4878aSAndroid Build Coastguard Worker ``always`` 56*61c4878aSAndroid Build Coastguard Worker The subcommand name will always be reported. 57*61c4878aSAndroid Build Coastguard Worker 58*61c4878aSAndroid Build Coastguard Worker.. code-block:: json 59*61c4878aSAndroid Build Coastguard Worker 60*61c4878aSAndroid Build Coastguard Worker { 61*61c4878aSAndroid Build Coastguard Worker "pw": { 62*61c4878aSAndroid Build Coastguard Worker "pw_cli_analytics": { 63*61c4878aSAndroid Build Coastguard Worker "prod_url": "https://www.google-analytics.com/mp/collect", 64*61c4878aSAndroid Build Coastguard Worker "debug_url": "https://www.google-analytics.com/debug/mp/collect", 65*61c4878aSAndroid Build Coastguard Worker "report_command_line": false, 66*61c4878aSAndroid Build Coastguard Worker "report_project_name": false, 67*61c4878aSAndroid Build Coastguard Worker "report_remote_url": false, 68*61c4878aSAndroid Build Coastguard Worker "report_subcommand_name": "limited" 69*61c4878aSAndroid Build Coastguard Worker } 70*61c4878aSAndroid Build Coastguard Worker } 71*61c4878aSAndroid Build Coastguard Worker } 72*61c4878aSAndroid Build Coastguard Worker 73*61c4878aSAndroid Build Coastguard WorkerThere are three places these configs can be set, with increasing precedence: 74*61c4878aSAndroid Build Coastguard Worker 75*61c4878aSAndroid Build Coastguard Worker* The project config, at ``<project-root>/pigweed.json``, 76*61c4878aSAndroid Build Coastguard Worker* The user/project config, at ``<project-root>/.pw_cli_analytics.user.json``, 77*61c4878aSAndroid Build Coastguard Worker and 78*61c4878aSAndroid Build Coastguard Worker* The user config, at ``~/.pw_cli_analytics.json``. 79*61c4878aSAndroid Build Coastguard Worker 80*61c4878aSAndroid Build Coastguard WorkerThe user config contains a UUID for the user. It's set to a new value when 81*61c4878aSAndroid Build Coastguard Workeropting in (manually or by running ``pw cli-analytics --opt-in``) and cleared 82*61c4878aSAndroid Build Coastguard Workerwhen opting out (with ``pw cli-analytics --opt-out``). 83*61c4878aSAndroid Build Coastguard Worker 84*61c4878aSAndroid Build Coastguard WorkerIn general, decisions about what is shared about the project must come from the 85*61c4878aSAndroid Build Coastguard Workerproject config, the unique id of the user must come from the user config, and 86*61c4878aSAndroid Build Coastguard Workerother details can be set in any config. Also, a ``false`` value for ``enabled`` 87*61c4878aSAndroid Build Coastguard Workercan't be overridden. 88*61c4878aSAndroid Build Coastguard Worker 89*61c4878aSAndroid Build Coastguard WorkerIn addition, if ``PW_DISABLE_CLI_ANALYTICS`` is set, then all reporting is 90*61c4878aSAndroid Build Coastguard Workerdisabled. 91