In dairy farming, sensors are commonly applied to monitor animal health and performance. One key task of such sensors is the behaviour classification of cows. The behaviour classification needs to take into account the differences between stable and pasture: the process of feed intake by grazing is different from feed intake in the stable. Pasture management systems differ and this introduces further variability within pasture-based systems, e.g. by different sward heights. Moreover, on pasture, spatial variables like walking distance allow the inference of further information about cow behaviour. Therefore, data accessibility and customizability of sensors is important for the development of pasture specific behaviour classification algorithms. Our objective was to construct an open-source and neck located cowtracker that combines an accelerometer, gyroscope and global navigation satellite system sensors with an Arduino microcontroller. The blueprints of the cowtracker are provided in the manuscript. Cows were tracked on two commercial dairy farms with different breeds and in different grazing systems to ensure high variability of the data. Animal behaviour was classified by training a random forest algorithm that was used to predict animal behaviour from the sensor data. The training data was obtained from visual observations in the field and differentiating between the behaviours grazing, rumination, walking, resting and drinking. The overall accuracy was 0.94 when predicting test data consisting of data retained randomly from all individuals. The predictive performance slightly decreased to 0.89 overall accuracy when whole animal data sets were retained as test data. The decrease in predictive performance was stronger for the rarely observed behaviour drinking. As a showcase, cow behaviour was analysed and differed between the two grazing systems. In continuous grazing at low sward heights (6 cm) the cows allocated more time to grazing and walking whereas in rotational grazing with pre- and post-grazing sward heights of 11.3 cm and 6.3 cm respectively, the cows allocated more time to rumination and less to grazing. The observed grazing time was comparably short in this experiment. The spatial observations revealed longer walking distances and higher herd scatter in continuous grazing which reflects the greater effort in satisfying the feed demand in low swards.