This is the wording of our teacher, the Rema, regarding what our teacher, the Beit Yosef, wrote: There are places where they interrupt the blessings of the Shema to say piyyutim. And it is proper to refrain from saying them. And he wrote regarding this: And some say there is no prohibition in the matter, and so they are accustomed in all places to say them. And one who is lenient and does not say them has lost nothing. Nevertheless, he should not engage in any matter, and even in matters of Torah it is prohibited to interrupt and engage, as long as the congregation is saying piyyutim. All the more so is it prohibited to speak idle chatter. Nevertheless, one who learns by means of contemplation, who looks in a book and contemplates—there is no prohibition in this, for contemplation is not like speech. However, because of this they may come to speak, and they will come to an interruption. Therefore, a person should not separate himself from the congregation in a place where they are accustomed to saying them, and he should say them with them. Thus far his words. And some are accustomed not to say those that are before the Shemoneh Esrei, but the piyyut that is in the repetition of the emissary of the congregation they do say. And so it is proper to do, and to be careful not to cancel any piyyut of the congregation, for Heaven forbid he will be punished. And the Bach wrote that one of the great men in his days began to cancel the saying of Kerovetz, and he did not complete his year, see there. And Kerovetz is an acronym: "The voice of rejoicing and salvation is in the tents of the righteous." (The Magen Avraham, subsection 1, brought from our teacher Moshe Peretz that it is proper to say piyyutim before the blessing of "Yotzer Or" and afterwards he should bless, see there. And it seems to me that it is proper. And what the Magen Avraham wrote from siman 54 requires study, for how is this called an interruption? See there. And be precise and you will find it easy.)
וזה לשונו רבינו הרמ"א על מה שכתב רבינו הבית יוסף: יש מקומות שמפסיקין בברכות קריאת שמע לומר פיוטין. ונכון למנוע מלאומרם. וכתב על זה: ויש אומרים דאין איסור בדבר, וכן נוהגים בכל המקומות לאומרם. והמיקל ואינו אומרם לא הפסיד. ומכל מקום לא יעסוק בשום דבר, ואפילו בדברי תורה אסור להפסיק ולעסוק, כל זמן שהציבור אומר פיוטים. כל שכן שאסור לדבר שיחה בטילה. ומכל מקום מי שלומד על ידי הרהור, שרואה בספר ומהרהר – לית בה איסורא, דהרהור לאו כדיבור דמי. אלא שמתוך כך יבואו לדבר, ויבואו לידי הפסק. ועל כן אין לאדם לפרוש עצמו מהציבור במקום שנהגו לאומרם, ויאמר אותם עמהם. עד כאן לשונו. ויש נוהגים שלא לאמר אותם שקודם שמונה עשרה, אבל הפייט שבחזרת שליח הציבור אומרים. וכן נכון לעשות, וליזהר שלא לבטל שום פיוט מהציבור, כי חס ושלום יענש. וכתב הב"ח שאחד מן הגדולים בימיו התחיל לבטל מלומר קרוב"ץ, ולא הוציא שנתו, עיין שם. וקרוב"ץ הוא ראשי תיבות: קול רנה וישועה באהלי צדיקים. (המגן אברהם סעיף קטן א' הביא מרבינו משה פרץ שנכון לומר פיוטים קודם ברכת "יוצר אור" ואחר כך יברך, עיין שם. ונראה לי דנכון הוא. ומה שכתב המגן אברהם מסימן נ"ד צריך עיון, דאיך מקרי זה הפסק? עיין שם. ודייק ותמצא קל.)