If the same keyword appears in two different ad groups, which ad is triggered depends on a number of factors. The entire context of the user’s search query is considered. For example, if there are any geographic implications to the user’s search query and the campaign in which one of the ads appears has a geo-targeting setting that is relevant, that ad should be displayed. If all else is equal, the ad with the highest bid and quality combination should be displayed.