tag manager code now passed into function to simplify extension