Aims. We develop an extended percolation method to allow the comparison of geometrical properties of the real cosmic web with the simulated dark matter web for an ensemble of over- and under-density systems. Methods. We scan density fields of dark matter (DM) model and SDSS observational samples, and find connected over- and underdensity regions in a large range of threshold densities. Lengths, filling factors and numbers of largest clusters and voids as functions of the threshold density are used as percolation functions. Results. We find that percolation functions of DM models of different box sizes are very similar to each other. This stability suggests that properties of the cosmic web, as found in the present paper, can be applied to the cosmic web as a whole. Percolation functions depend strongly on the smoothing length. At smoothing length 1 $h^{-1}$ Mpc the percolation threshold density for clusters is $log P_C = 0.718 pm 0.014$, and for voids is $log P_V = -0.816 pm 0.015$, very different from percolation thresholds for random samples, $log P_0 = 0.00 pm 0.02$. Conclusions. The extended percolation analysis is a versatile method to study various geometrical properties of the cosmic web in a wide range of parameters. Percolation functions of the SDSS sample are very different from percolation functions of DM model samples. The SDSS sample has only one large percolating void which fills almost the whole volume. The SDSS sample contains numerous small isolated clusters at low threshold densities, instead of one single percolating DM cluster. These differences are due to the tenuous dark matter web, present in model samples, but absent in real observational samples.