If you need to update Magento 2 Google Analytics 4 by Magefan, please follow the steps below.
Note: that the update instructions depend on the method the Google Analytics 4 extension was installed with.
Post Contents [hide]
Update using composer
If the Google Analytics 4 module was installed via the composer (check if vendor/magefan/module-google-tag-manager folder exists), then you need to run these simple CLI commands in Magento 2 directory:
composer remove magefan/module-NAME
composer require magefan/module-NAME ^x.x.x
# replace NAME with:
# google-tag-manager - for Basic edition
# google-tag-manager-plus - for Plus edition
# google-tag-manager-extra - for Extra edition
# replace x.x.x with the version you want to use
php bin/magento setup:upgrade
php bin/magento setup:di:compile
php bin/magento setup:static-content:deploy
Note: if you don't want your website to be down during deployment, try these zero downtime deployment commands for Magento 2.
Update using archive and FTP
If the Google Analytics 4 module was installed via FTP (check if app/code/Magefan/GoogleTagManager folder exists), then follow these commands:
1. Download the latest version of the Google Analytics 4 extension archive from magefan.com.
2. Extract archive.
3. Make the backup copy of the app/code/Magefan/GoogleTagManager, or app/code/Magefan/GoogleTagManagerPlus, or app/code/Magefan/GoogleTagManagerExtra folder on your server and then remove it.
4. Using FTP, copy app folder from the archive to your Magento 2 Directory.
5. Run update CLI commands in Magento 2 directory:
php bin/magento setup:upgrade
php bin/magento setup:di:compile
php bin/magento setup:static-content:deploy