How to assign badges with a button click

I’m frustrated, I was able to perform as the tag assignment example, but can not use with it. Since I want to instill an element according to the tag, for example, but the customer side does not bring who owns the tag, the example in the documentation does not work.