Other / Miscellaneous / GA Tracking Code

The GA Tracking Code bookmarklet finds and displays all Google Analytics and Google Tag Manager tracking codes on the page. Searches script src attributes and inline script content for tracking IDs matching patterns: UA-XXXXXXXXX-X (Universal Analytics), G-XXXXXXXXXX (Google Analytics 4), and GTM-XXXXXX (Google Tag Manager). Displays found tracking codes in a floating panel with a textarea for easy copying and a copy button. Alerts if no tracking codes are found. Useful for SEO and analytics verification.

Run GA Tracking Code

Test run or drag to
bookmarklets bar to install

javascript:%21function()%7Blet%20e%3Dfunction()%7Blet%20e%3Ddocument.getElementsByTagName(%22script%22)%2Ct%3D%5B%5D%3Bfor(let%20n%20of%20e)%7Bif(n.src)%7Blet%20e%3Dn.src.match(%2F(UA-%5Cd%7B4%2C9%7D-%5Cd%7B1%2C4%7D%7CG-%5BA-Za-z0-9%5D%2B%7CGTM-%5BA-Za-z0-9%5D%2B)%2F)%3Be%26%26t.push(e%5B0%5D)%7Dif(n.innerHTML)%7Blet%20e%3Dn.innerHTML.match(%2FUA-%5Cd%7B4%2C9%7D-%5Cd%7B1%2C4%7D%2F)%2Co%3Dn.innerHTML.match(%2FG-%5BA-Za-z0-9%5D%2B%2F)%2Cl%3Dn.innerHTML.match(%2FGTM-%5BA-Za-z0-9%5D%2B%2F)%3Be%26%26t.push(e%5B0%5D)%2Co%26%26t.push(o%5B0%5D)%2Cl%26%26t.push(l%5B0%5D)%7D%7Dreturn%20t%7D()%3Bif(e.length%3E0)%7Bvar%20t%3Blet%20n%2Co%2Cl%2Ca%2Cr%3Bt%3De%2C(n%3Ddocument.createElement(%22div%22)).style.position%3D%22fixed%22%2Cn.style.top%3D%2210%25%22%2Cn.style.left%3D%2250%25%22%2Cn.style.transform%3D%22translateX(-50%25)%22%2Cn.style.padding%3D%2220px%22%2Cn.style.backgroundColor%3D%22white%22%2Cn.style.border%3D%221px%20solid%20%23ccc%22%2Cn.style.boxShadow%3D%220%202px%2010px%20rgba(0%2C0%2C0%2C0.1)%22%2Cn.style.zIndex%3D%2210000%22%2Cn.style.maxWidth%3D%22600px%22%2Cn.style.wordBreak%3D%22break-word%22%2C(o%3Ddocument.createElement(%22h2%22)).innerText%3D%22Google%20Analytics%20%26%20GTM%20Tags%22%2Co.style.margin%3D%220%200%2010px%200%22%2Co.style.fontSize%3D%221.125rem%22%2Co.style.fontFamily%3D%22Arial%2C%20sans-serif%22%2Cn.appendChild(o)%2C(l%3Ddocument.createElement(%22textarea%22)).style.width%3D%22100%25%22%2Cl.style.height%3D%22400px%22%2Cl.style.marginBottom%3D%2210px%22%2Cl.value%3Dt.join(%22%5Cn%22)%2Cn.appendChild(l)%2C(a%3Ddocument.createElement(%22button%22)).innerText%3D%22Copy%22%2Ca.style.marginRight%3D%2210px%22%2Ca.onclick%3Dfunction()%7Bl.select()%2Cdocument.execCommand(%22copy%22)%7D%2Cn.appendChild(a)%2C(r%3Ddocument.createElement(%22button%22)).innerText%3D%22Close%22%2Cr.onclick%3Dfunction()%7Bdocument.body.removeChild(n)%7D%2Cn.appendChild(r)%2Cdocument.body.appendChild(n)%7Delse%20alert(%22No%20Google%20Analytics%20or%20GTM%20tags%20found.%22)%7D()%2Cconsole.log(%22%5CnSource%3A%20https%3A%2F%2Fwww.kyleplace.com%2Fpost%2Fseo-bookmarklets%23viewer-72rwm47669%5CnBookmarklet%20name%3A%20Show%20GA%20Tracking%20Codes%5Cn%22)%3B
← Back to all bookmarklets