This is achieved by calling the set_stringsToShare(url, title) Client-side method of the control. Both its arguments are optional and the corresponding strings are not modified if there isn't a new value provided. After this method is called the change is applied not only to the Styled buttons, but also to the Standard (or third party) buttons as well. Their counters are also updated according to the new values after that, which requires a request to the respective network's server.
This can also be done in the OnSocialButtonClicking event for each individual Styled button by calling the set_stringsToShare() method that is exposed by the event arguments object that is passed to the event handler.