Currently, I am using analytics.js, but GA4 requires gtag.js. As a result, the setup wizard does not successed.

But anyway, we still need to Create Property instead of skipping this step.

After creating the property, we will have two properties for ESL,

But we have not added the javascript for ESL-GA4. The tracking code can be found via

Admin -> ESL-GA4 -> Data Streams -> Web -> Add new on-page tag

and then paste to the source of the webpages. Since ESL-GA4 is another property from ESL, do not remove the existing tracking code for ESL.

(Don’t remove the old analytics.js tag; it will continue to collect data for your Universal Analytics property. The gtag.js tag that you’re adding will collect data for your new Google Analytics 4 property.)

Blogs on explaining the difference between different versions of Google Analytics (GA)

## Exclude localhost¶

### first attempt¶

follow the instruction in [GA4] Filter out internal traffic, and add 127.0.0.1 as the internal ip, but it does not work. Then I realized that although I am visited the website from 127.0.0.1, the actual GA information is sent from my public IP.

### second attempt¶

I found the answers in how to disable google analytics on localhost, and then found the official documentations

where the first one is for the old GA, and the second one is for GA4. Although there is an alternative method for GA4, we can use the same method as in old GA, and the resulting scripts to be added before the GA script is

        <script>
var host = window.location.hostname;
if (host == '127.0.0.1' || host == 'localhost') {
window['ga-disable-UA-XXXXXXX'] = true;
window['ga-disable-G-XXXXXX'] = true;
}
</script>