If you are working on a page with frames, the code must be inserted only into the HTML code of the main frame and NOT into the fixed frames or in the frameset page , i.e. the page which creates the frames structure.
Moreover, in compliance with the international Internet audience measurement standards and for a smooth running, the ShinyStat code must be inserted into a single frame - i.e. into the main frame - independently of the total number of frames that compose the page.