This paper investigates the data-driven consensus tracking problem for multiagent systems with both fixed communication topology and switching topology by utilizing a distributed model free adaptive control (MFAC) method. Here, agent's dynamics are described by unknown nonlinear systems and only a subset of followers can access the desired trajectory. The dynamical linearization technique is applied to each agent based on the pseudo partial derivative, and then, a distributed MFAC algorithm is proposed to ensure that all agents can track the desired trajectory. It is shown that the consensus error can be reduced for both time invariable and time varying desired trajectories. The main feature of this design is that consensus tracking can be achieved using only input-output data of each agent. The effectiveness of the proposed design is verified by simulation examples.