Link and image tracking in campaigns

Your software
My Mautic version is: 4.43
My PHP version is: 7.4
My Database type and version is: MariaDB 10.3

Your problem
Hi,

I’m very new to Mautic and try to get it working with my nginx configuration. I have most things working, but seems like my images / assets are not configured correctly. I’m using the Paprika email template and I don’t see the images load properly when the URL looks like - https://mdev.com/index.php/themes/paprika/assets/paprikas.jpg?vb5bfa802

However, if I remove the index.php the image loads fine but it does not show up as page hit when the email is opened by the client.
``https://mdev.com/themes/paprika/assets/paprikas.jpg?vb5bfa802`

Q1: Is this https://mdev.com/index.php/themes/paprika/assets/paprikas.jpg?vb5bfa802 supposed to work? I couldn’t find any examples for nginx configuration, so any pointers would be helpful. I’m attaching my configuration for reference.

Q2: Another issue in the same email is I don’t see links being tracked, even though the default configuration does seem to have link tracking enabled. Is there anything extra I need to do to track emails?

nginx.conf.template

server {
        listen 80;
        listen [::]:80;

        server_name ${HOST};
        
        location / {
                rewrite ^ https://$host$request_uri? permanent;
        }
}

server {
        listen 443 ssl http2;
        listen [::]:443 ssl http2;
        server_name ${HOST};

        index index.php index.html index.htm;

        root /var/www/html/mautic/docroot;

        server_tokens off;

        ssl_certificate /etc/letsencrypt/live/${HOST}/fullchain.pem;
        ssl_certificate_key /etc/letsencrypt/live/${HOST}/privkey.pem;

        ssl_session_timeout 5m;
        ssl_ciphers "HIGH:!aNULL:!MD5 or HIGH:!aNULL:!MD5:!3DES";

        client_max_body_size 4M;
        client_body_buffer_size 128k;
        
        index index.php index.html index.htm index.nginx-debian.html;
        
        location / {
            # try to serve file directly, fallback to app.php
            try_files $uri /index.php$is_args$args;
        }

        location ~ /(mtc.js|1.js|mtracking.gif|.*\.gif|mtc) {
            # default_type "application/javascript";
            try_files $uri /index.php$is_args$args;
        }

        location ~* ^/index.php {
            fastcgi_split_path_info ^(.+?\.php)(/.*)$;
            
            # Check that the PHP script exists before passing it
            # try_files $fastcgi_script_name =404;
            
            # try_files $fastcgi_path_info =404;
            # try_files $fastcgi_path_info $fastcgi_script_name =404;
            
            fastcgi_pass mautic:9000;
            fastcgi_index index.php;
            fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
            include fastcgi_params;
            
            fastcgi_buffer_size 128k;
            fastcgi_buffers 256 16k;
            fastcgi_busy_buffers_size 256k;
            fastcgi_temp_file_write_size 256k;
        }
}

I think I might have found answer to question. It was my site url which had index.php in it. Now, I can view all images, but still don’t see image and and link clicks being tracked.

I’m testing using send email to contact.

Looking at the email source, the links seems to be correct -

https://mdev.com/r/cb3e2ede01e29f89617fbfc9b?ct=YTo1OntzOjY6InNvdXJjZSI7YToyOntpOjA7czoxNDoiY2FtcGFpZ24uZXZlbnQiO2k6MTtpOjE7fXM6NToiZW1haWwiO2k6MjtzOjQ6InN0YXQiO3M6MjI6IjYzNDQ0ZGM4NjFkYmMwNTUzMjE3OTkiO3M6NDoibGVhZCI7czoxOiI0IjtzOjc6ImNoYW5uZWwiO2E6MTp7czo1OiJlbWFpbCI7aToyO319&

and the redirects seem to work, but still don’t see tracking in campaign UI or contact profile

Found the problem, I was using same browser for testing emails. Opening in incognito worked.

h/t: Link Tracking in Emails not working - #2 by joeyk

This topic was automatically closed 36 hours after the last reply. New replies are no longer allowed.