For when the one supreme God of gods is thought of, even by those who believe that there are other gods, and who call them by that name, and worship them as gods, their thought takes the form of an endeavor to reach the conception of a nature, than which nothing more excellent or more exalted exists. And since men are moved by different kinds of pleasures, partly by those which pertain to the bodily senses, partly by those which pertain to the intellect and soul, those of them who are in bondage to sense think that either the heavens, or what appears to be most brilliant in the heavens, or the universe itself, is God of gods: or if they try to get beyond the universe, they picture to themselves something of dazzling brightness, and think of it vaguely as infinite, or of the most beautiful form conceivable; or they represent it in the form of the human body, if they think that superior to all others. Or if they think that there is no one God supreme above the rest, but that there are many or even innumerable gods of equal rank, still these too they conceive as possessed of shape and form, according to what each man thinks the pattern of excellence. Those, on the other hand, who endeavor by an effort of the intelligence to reach a conception of God, place Him above all visible and bodily natures, and even above all intelligent and spiritual natures that are subject to change. All, however, strive emulously to exalt the excellence of God: nor could any one be found to believe that any being to whom there exists a superior is God. And so all concur in believing that God is that which excels in dignity all other objects.
Note the emphasis on excellence here. We get a similar precursor in Boethius (Consolation of Philosophy, Book III, Prose X, emphasis added):
Next to consider where the dwelling-place of this happiness may be. The common belief of all mankind agrees that God, the supreme of all things, is good. For since nothing can be imagined better than God, how can we doubt Him to be good than whom there is nothing better? Now, reason shows God to be good in such wise as to prove that in Him is perfect good. For were it not so, He would not be supreme of all things; for there would be something else more excellent, possessed of perfect good, which would seem to have the advantage in priority and dignity, since it has clearly appeared that all perfect things are prior to those less complete. Wherefore, lest we fall into an infinite regression, we must acknowledge the supreme God to be full of supreme and perfect good. But we have determined that true happiness is the perfect good; therefore true happiness must dwell in the supreme Deity.
Anselm himself ties his famous "ontological argument" to the Good both before and after the argument itself. In the prayer of Proslogion 1, he repeatedly refers to man's good as contemplation of God, without which nothing can be happy, and reflects on how man has lost this good. And then, more explicitly, we have a more explicit tie-in at Proslogion 5:
What are you, then, Lord God, than whom nothing greater can be conceived? But what are you, except that which, as the highest of all beings, alone exists through itself, and creates all other things from nothing? For, whatever is not this is less than a thing which can be conceived of. But this cannot be conceived of you. What good, therefore, does the supreme Good lack, through which every good is?
Interestingly, one finds this connection between the Good, or happiness as possession of the Good, in conjunction with very different kinds of arguments that still receive the label "ontological argument". Spinoza's is perhaps the best known example, since the "ontological argument" in Book of the Ethics is Spinoza's first step in the attempt to prove that there is a happiness that is utterly unshakeable and certain (which is why I sometimes tell people that in a sense you have to read the Ethics backwards to understand its point properly). And Iris Murdoch's not-quite-acceptance, not-quite-rejection of an "ontological argument" in her excellent Metaphysics as a Guide to Morals is intimately and explicitly linked with her attempt to explore the idea of the Good. This is a link that I think needs to be studied more.