# Migrating from Universal Analytics to Google Analytics 4

**URL:** <https://discourse.cakephp.org/t/migrating-from-universal-analytics-to-google-analytics-4/11075>\
**Category:** Need Help\
**Created:** [March 21, 2023, 2:04am UTC](https://discourse.cakephp.org/t/migrating-from-universal-analytics-to-google-analytics-4/11075 "2023-03-21T02:04:41Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![kashifau](https://avatars.discourse-cdn.com/v4/letter/k/2acd7d/32.png) [@kashifau](https://discourse.cakephp.org/u/kashifau)\
**Post date:** [March 21, 2023, 2:04am UTC](https://discourse.cakephp.org/t/migrating-from-universal-analytics-to-google-analytics-4/11075/1 "2023-03-21T02:04:41Z")

</div>

I am in the process of migrating from universal analytics to google analytics 4. I am currently using cakephp 3.10 and my analytics.js code is setup as an element block named google.ctp. Inside that file a different analytics id (UA-XXXX) is set based on if debug mode is on or not to track data from subdomains. How should I include GA4 (gtag.js) without changing the current process as I want to keep the existing universal analytics setup until it is active.
