Catalyzes the transfer of N-acetylglucosamine (GlcNAc) residues from UDP-N-acetyl-alpha-D-glucosamine donnors to beta (1->4)- linked or beta-(1->3)-linked galactose residues on O-glycans like core 2 branched O-glycans (PubMed:10430883). Necessary for the synthesis of type III mucin which is specifically produced in the stomach, duodenum, and pancreatic duct (PubMed:10430883). May protect against inflammation-associated gastric adenocarcinomas (By similarity). . This is the function of A4GNT (alpha-1,4-N-acetylglucosaminyltransferase, ENSG00000118017).