Let the discount given to the customer be \( x % \).
The selling price of the article after discount is:
\[
\text{Selling Price} = 4000 \times \left( 1 - \frac{x}{100} \right)
\]
The shopkeeper gains 20% on the cost price, so the selling price is also:
\[
\text{Selling Price} = 3000 \times 1.20 = 3600
\]
Equating the two expressions for selling price:
\[
4000 \times \left( 1 - \frac{x}{100} \right) = 3600
\]
Solving for \( x \):
\[
4000 - 40x = 3600 \quad \Rightarrow \quad 40x = 400 \quad \Rightarrow \quad x = 10
\]
So, the percentage of discount given is \( 10% \).