The distributed trigger counting (DTC) problem is a fundamental block for many distributed applications. Particularly, such a problem is to raise an alert while the number of triggers received by the whole system reaches a pre‐defined amount. There have been a few algorithms proposed to solve the DTC problem in the literature. However, these existing algorithms are all under the assumption that each process knows what kind of network topology the whole system forms as well as playing distinct kind of role in the system. The foregoing assumption is not practical for wireless sensor networks because the network topology of a wireless sensor network cannot be obtained in advance, and the roles of all processes are basically identical during the computation. In this paper, we propose a novel distributed algorithm to solve the DTC problem, free of any aforementioned global assumption. Moreover, in order to reduce the message complexity of our algorithm, we further propose a more message‐efficient version, only with one extra requirement that all processes have learned ahead the number of processes in the system. Copyright © 2016 John Wiley & Sons, Ltd.