Install or Fix GTM Server Side Tagging on dedicated server
Budget: €30 – €250 EUR
Google Tag Manager - Server Side Tagging (live/preview as suggested) with docker
Current Problem: GTM live call results in different Server Errors (500, 400).
Requirement: GTM live call results in OK 200 OK on Main Website
There are live and preview servers as suggested by Google. GTM Tags an Triggers are configured
GTM runs with Docker, Apache 2, website (Magento 2) uses varnish cache
Docker:
docker run -d --name gtm-vorschau -p 127.0.0.1:8075:8080 -e CONTAINER_CONFIG='XXXXX' -e RUN_AS_PREVIEW_SERVER='true' gcr.io/cloud-tagging-10302018/gtm-cloud-image:stable
docker run -d --name gtm -p 127.0.0.1:8076:8080 -e CONTAINER_CONFIG='XXXXX' -e PREVIEW_SERVER_URL='https://gtmvorschau.example.de' gcr.io/cloud-tagging-10302018/gtm-cloud-image:stable
Apache 2 - GTM Live Server results:
https://gtm.example.de/healthz = 200
https://gtm.example.de/gtm.js = 400 Bad Request
https://gtm.example.de/gtm/debug?id=GTM-52TMMZXm_auth=XXXXXXm_preview=env-3 = 500
Internal Server Error
Apache 2 - GTM Preview Server is working:
https://gtmvorschau.example.de/healthz = 200
https://gtmvorschau.example.de/gtm/debug?id=GTM-52TMMZXm_auth=XXXXXXm_preview=env-3 = 200
_________________
docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
79645c5d4f83 gcr.io/cloud-tagging-10302018/gtm-cloud-image:stable "/nodejs/bin/node se…" About a minute ago Up About a minute (healthy) 127.0.0.1:8076-8080/tcp gtm
f51c4737e801 gcr.io/cloud-tagging-10302018/gtm-cloud-image:stable "/nodejs/bin/node se…" About a minute ago Up About a minute (healthy) 127.0.0.1:8075-8080/tcp gtm-vorschau
_________________
- Apache2 -
GTM:
VirtualHost *:443
ServerName gtm.example.de
SSLProxyEngine on
ProxyPreserveHost On
ProxyRequests Off
ProxyPass / http://127.0.0.1:8076/
ProxyPassReverse / http://127.0.0.1:8076/
SSLEngine On
SSLCertificateFile "/etc/ssl/example/gtm/certificate.crt"
SSLCertificateKeyFile "/etc/ssl/example/gtm/privkey.pem"
SSLCertificateChainFile "/etc/ssl/example/gtm/cert.cabundle"
/VirtualHost
GTM-Preview:
VirtualHost *:443
ServerName gtmvorschau.example.de
SSLProxyEngine on
ProxyPreserveHost On
ProxyRequests Off
ProxyPass / http://127.0.0.1:8075/
ProxyPassReverse / http://127.0.0.1:8075/
SSLEngine on
SSLCertificateFile /etc/ssl/certs/example-traffic-selfsigned.crt
SSLCertificateKeyFile /etc/ssl/private/example-traffic-selfsigned.key
/VirtualHost
Main Website:
VirtualHost *:8080
ServerName www.example.de
ServerAlias example.de
RewriteEngine On
DocumentRoot /var/www/example.de
AllowEncodedSlashes NoDecode
ErrorLog /var/log/apache2/cardport-8080.error.log
/VirtualHost
VirtualHost *:443
RewriteEngine on
ServerName www.example.de
ServerAlias example.de
SSLEngine on
SSLCertificateFile "/etc/ssl/example/2022/certificate.crt"
SSLCertificateKeyFile "/etc/ssl/example/2022/privkey.pem"
SSLCertificateChainFile "/etc/ssl/example/2022/bundle.crt"
# varnish proxy
ProxyPreserveHost On
ProxyPass / http://127.0.0.1:80/
ProxyPassReverse / http://127.0.0.1:80/
RequestHeader set X-Forwarded-Proto "https"
DocumentRoot /var/www/example.de
/VirtualHost
_________________
Website (Magento 2) runs with varnish reverse proxy cache:
tcp 0 0 127.0.0.1:8075 0.0.0.0:* LISTEN 4415/docker-proxy
tcp 0 0 127.0.0.1:6379 0.0.0.0:* LISTEN 19413/redis-server
tcp 0 0 127.0.0.1:8076 0.0.0.0:* LISTEN 4521/docker-proxy
tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 19427/varnishd
tcp 0 0 0.0.0.0:10000 0.0.0.0:* LISTEN 825/perl
tcp 0 0 0.0.0.0:21 0.0.0.0:* LISTEN 19810/pure-ftpd (SE
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 1007/sshd
tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN 2416/exim4
tcp 0 0 127.0.0.1:6082 0.0.0.0:* LISTEN 19427/varnishd
Current Problem: GTM live call results in different Server Errors (500, 400).
Requirement: GTM live call results in OK 200 OK on Main Website
There are live and preview servers as suggested by Google. GTM Tags an Triggers are configured
GTM runs with Docker, Apache 2, website (Magento 2) uses varnish cache
Docker:
docker run -d --name gtm-vorschau -p 127.0.0.1:8075:8080 -e CONTAINER_CONFIG='XXXXX' -e RUN_AS_PREVIEW_SERVER='true' gcr.io/cloud-tagging-10302018/gtm-cloud-image:stable
docker run -d --name gtm -p 127.0.0.1:8076:8080 -e CONTAINER_CONFIG='XXXXX' -e PREVIEW_SERVER_URL='https://gtmvorschau.example.de' gcr.io/cloud-tagging-10302018/gtm-cloud-image:stable
Apache 2 - GTM Live Server results:
https://gtm.example.de/healthz = 200
https://gtm.example.de/gtm.js = 400 Bad Request
https://gtm.example.de/gtm/debug?id=GTM-52TMMZXm_auth=XXXXXXm_preview=env-3 = 500
Internal Server Error
Apache 2 - GTM Preview Server is working:
https://gtmvorschau.example.de/healthz = 200
https://gtmvorschau.example.de/gtm/debug?id=GTM-52TMMZXm_auth=XXXXXXm_preview=env-3 = 200
_________________
docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
79645c5d4f83 gcr.io/cloud-tagging-10302018/gtm-cloud-image:stable "/nodejs/bin/node se…" About a minute ago Up About a minute (healthy) 127.0.0.1:8076-8080/tcp gtm
f51c4737e801 gcr.io/cloud-tagging-10302018/gtm-cloud-image:stable "/nodejs/bin/node se…" About a minute ago Up About a minute (healthy) 127.0.0.1:8075-8080/tcp gtm-vorschau
_________________
- Apache2 -
GTM:
VirtualHost *:443
ServerName gtm.example.de
SSLProxyEngine on
ProxyPreserveHost On
ProxyRequests Off
ProxyPass / http://127.0.0.1:8076/
ProxyPassReverse / http://127.0.0.1:8076/
SSLEngine On
SSLCertificateFile "/etc/ssl/example/gtm/certificate.crt"
SSLCertificateKeyFile "/etc/ssl/example/gtm/privkey.pem"
SSLCertificateChainFile "/etc/ssl/example/gtm/cert.cabundle"
/VirtualHost
GTM-Preview:
VirtualHost *:443
ServerName gtmvorschau.example.de
SSLProxyEngine on
ProxyPreserveHost On
ProxyRequests Off
ProxyPass / http://127.0.0.1:8075/
ProxyPassReverse / http://127.0.0.1:8075/
SSLEngine on
SSLCertificateFile /etc/ssl/certs/example-traffic-selfsigned.crt
SSLCertificateKeyFile /etc/ssl/private/example-traffic-selfsigned.key
/VirtualHost
Main Website:
VirtualHost *:8080
ServerName www.example.de
ServerAlias example.de
RewriteEngine On
DocumentRoot /var/www/example.de
AllowEncodedSlashes NoDecode
ErrorLog /var/log/apache2/cardport-8080.error.log
/VirtualHost
VirtualHost *:443
RewriteEngine on
ServerName www.example.de
ServerAlias example.de
SSLEngine on
SSLCertificateFile "/etc/ssl/example/2022/certificate.crt"
SSLCertificateKeyFile "/etc/ssl/example/2022/privkey.pem"
SSLCertificateChainFile "/etc/ssl/example/2022/bundle.crt"
# varnish proxy
ProxyPreserveHost On
ProxyPass / http://127.0.0.1:80/
ProxyPassReverse / http://127.0.0.1:80/
RequestHeader set X-Forwarded-Proto "https"
DocumentRoot /var/www/example.de
/VirtualHost
_________________
Website (Magento 2) runs with varnish reverse proxy cache:
tcp 0 0 127.0.0.1:8075 0.0.0.0:* LISTEN 4415/docker-proxy
tcp 0 0 127.0.0.1:6379 0.0.0.0:* LISTEN 19413/redis-server
tcp 0 0 127.0.0.1:8076 0.0.0.0:* LISTEN 4521/docker-proxy
tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 19427/varnishd
tcp 0 0 0.0.0.0:10000 0.0.0.0:* LISTEN 825/perl
tcp 0 0 0.0.0.0:21 0.0.0.0:* LISTEN 19810/pure-ftpd (SE
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 1007/sshd
tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN 2416/exim4
tcp 0 0 127.0.0.1:6082 0.0.0.0:* LISTEN 19427/varnishd