This study explored how internet queries vary in facilitating monitoring of pertussis, and the effects of sociodemographic characteristics on such variation by city in Shandong province, China. We collected weekly pertussis notifications, Baidu Index (BI) data and yearly sociodemographic data at the city level between 1 January 2009 and 31 December 2017. Spearman's correlation was performed for temporal risk indices, generalised linear models and regression tree models were developed to identify the hierarchical effects and the threshold between sociodemographic factors and internet query data with pertussis surveillance. The BI was correlated with pertussis notifications, with a strongly spatial variation among cities in temporal risk indices (composite temporal risk metric (CTRM) range: 0.59–1.24). The percentage of urban population (relative risk (RR): 1.05, 95% confidence interval (CI) 1.03–1.07), the proportion of highly educated population (RR: 1.27, 95% CI 1.16–1.39) and the internet access rate (RR: 1.04, 95% CI 1.02–1.05) were correlated with CTRM. Higher RRs in the three identified sociodemographic factors were associated with higher stratified CTRM. The percentage of highly educated population was the most important determinant in the BI with pertussis surveillance. The findings may lead to spatially-specific criteria to inform development of an early warning system of pertussis infections using internet query data.