Yes. If you book through United, it will be an 016 (United) ticket and earn by amount spent.
The only caveat is that it must be operated by a Star Alliance airline or a specific named partner. Travel on other airlines, such as HA or CX, will not earn even though United may market connections with these airlines. Although
this thread is mostly about
non 016 tickets, the list of non-status-earning partners is still accurate.