Posts

[GA4] Generate Exploration report using event parameters

Presumption: You are using GA4 + GTM (optional) You submit to GA a custom event (e.g. mycustomevent) with some event parameters e.g. {"key1": "value1", "key2": "value2"} Now you want to generate a report based on `key1` to see how many events happened Here is how: You first define a "Custom Definition" As of this writing, it is in: Admin - Property Settings - Data display - Custom definitions Click "Create Custom Dimension" Set whatever dimension name you want.   For example in my case the name is: "Key 1" Scope set to "event" (default) Enter any description, or not if you don't want to Event parameter: enter value that is "Exactly" as you defined in event parameters. For example in my case, it is "key1" Click save. Now go to "Explorer" in your GA dashboard on the left Create or select a report you want to edit In "dimension" on the left, click the "+" b...

[Solved] Apache 2.4.62 - AH00534: httpd: Configuration error: More than one MPM loaded.

 If you are building Apache/httpd from source (in my case it is httpd 2.4.62) and you encounter this error: AH00534: httpd: Configuration error: More than one MPM loaded. But you are absolutely sure that in your config file you just enable 1 module, here is what you need to check: In my case, my command of building Apache from source is this: ./configure --prefix=/usr/local/httpd-2.4.62 \ --enable-proxy \ --enable-proxy-http \ --enable-proxy-ajp \ --enable-forward \ --enable-module=most \ --enable-mods-shared=all \ --enable-so \ --enable-include \ --enable-headers \ --enable-deflate \ --enable-cache \ --enable-disk-cache \ --enable-mem-cache \ --enable-rewrite \ --enable-static-support \ --enable-expires \ --with-apr-util=/usr/local/apr \ --with-apr=/usr/local/apr Important: If you run httpd -M, you will see that mpm-event is "static", which means it is compiled as "static" module, i.e. pre-build and loaded by default. But if you add: --enable-mpms-shared \ --with-m...

[Working] Docker-compose + Nginx + PHP with Wordpress Multisites in subdirectory config

I'm sorry but I cannot add my config file here without a lot of editing.  Blogger.com is not good for developers who write technical blog easily.  Here is the blog on my medium.com site: https://medium.com/@alucard001/working-docker-compose-nginx-php-with-wordpress-multisites-in-subdirectory-config-cd51c0445d6a Hope it helps someone.

Recommended Security Headers for Nginx

This summary is not available. Please click here to view the post.

AWS cloudfront + S3 result in 503 error - S3 to serve HTML

Image
 Quick note: If you are serving HTML/CSS/JS/Any image files via AWS S3 with Cloudfront, but got 503 error, here is one way to solve: Simply put: In Viewer request, set cloudfront function to "serve-html-by-s3" Set Viewer repsonse to "No association" Setting Viewer response to value other than "No association" will result in 503 error. Hope it helps someone.

PHP 5.6 way to send AWS SNS topic message

This is an example PHP 5.6 script to send AWS SNS topic message. The architecture and assumption are as follow: Architecture: SNS (FIFO) -> SQS(FIFO) -> Lambda Only FIFO SNS can connect to FIFO SQS. Standard SNS cannot publish to FIFO SQS. Assumption: This script is executed in an EC2 instance. Assigned an AWS role to send SNS message. Because of above, supposed that there is no need to use Credential when creating SnsClient object. As the OS and PHP in this EC2 is old, the curl is already outdated. So it set http to false to bypass SSL verification.  Reference here . The $message part is designed for sending email for different vendor. In other words, it would vary in different case. Since SNS and SQS are FIFO, MessageGroupId must be set. It can be any random string, which is used to group message together for sending purpose. Here is the code <?php  require_once 'vendor/autoload.php'; use Aws\Sns\SnsClient; try{     $snsClient = new SnsClient([ ...

NodeJS dotenv .env: Which comes first? .env or environment var defined in Cloudformation?

As of this writing, in short: Cloud formation comes first. If you are using dotenv (.env), and you define the same variable as in your cloud formation template, cloud formation template will override the value in your .env