Frequently asked questions

Learn answers to frequently asked questions about using gtag.js with Google Analytics.

The Global Site Tag (gtag.js) provides a framework for streamlined web page tagging – giving you better control while making implementation easier. By using gtag.js, you will be able to benefit from the latest tracking features and integrations as they become available.

Is gtag.js for both web and apps?
gtag.js is used for tagging web pages. For mobile apps, use Google Analytics for Firebase.
What is the difference between Google Tag Manager and gtag.js, and which one should I use?

gtag.js and Google Tag Manager are separate and independent ways of tagging your website.

If you want to manage Google and third party tags from a single location without modifying your site’s code in the future, use Google Tag Manager.

If you would like to code tags on your site directly using JavaScript, use gtag.js.

Is gtag.js implemented on every web page?
This depends on what features you want implemented on your website. The standard Google Analytics gtag.js installation code includes pageview tracking by default. If your business goals require it, you can install additional features such as click tracking on every page, or on a subset of pages as desired.
Can I deploy 3rd party (non-Google) tags using gtag.js?
No, when using gtag.js from Google Analytics it only works for Google products. Use Google Tag Manager if you need a tag management solution that can handle 3rd party tags.
Does gtag.js support Google Optimize?
Yes. All that is required is to add the Optimize container id to the Google Analytics config snippet. Learn more.
If I switch from analytics.js to gtag.js for my Google Analytics implementation, will it affect my data?
No, switching between the tracking codes for Google Analytics will not affect your data (e.g. inflating total users, resetting client IDs, etc.) Google Analytics will track your web page usage as coded, regardless if the code was based on analytics.js or gtag.js.
If I use a 3rd party tag management system (TMS), do I need to make any updates?
No updates will be necessary. 3rd party tag management system implementations will continue to send hits to Google Analytics with no impact from the gtag.js release.
Was this article helpful?
How can we improve it?