Page Visit Tracking Not Working

Your software
My Mautic version is: v4.4.3
My PHP version is: PHP Version 8.0.22
My Database type and version is: 10.6.7-MariaDB-2ubuntu1.1

Your problem
My problem is:

Hello,

I’m trying to segment contacts based on page visit.

After they opt-in on my website, there’s a survey that leads to different pages.

So contacts get filtered into 4 different groups, so I can better market to them:

  • Business Owners (With Basic SEO Knowledge)
  • Business Owners (Intermediate)
  • Digital Marketer (Basic)
  • Advanced Digital Marketer

I need to be able to talk to these different types of prospects differently.

The issue is that contacts are getting added to all 4 segments.

This is my set up in Mautic:

Out of curiosity, I thought it could have been my system (either cache or IP) so I tried mobile data, and had a relative try at a different location, but the issue is the same.

These errors are showing in the log: None

Steps I have tried to fix the problem:

I tried both filters for segmenting, and a campaign. Neither work as intended.

You are connecting contacts to the “NO” side, is that okay?

I tried changing the “add to segment” actions to the left side. Now nothing is happening.

I’ve tried the Mautic code in the header, body, and footer on these pages but it hasn’t made a difference.

I also have a WordPress plugin called “Insert in Header & Footer” and the tracking code is there as well.

It seems like it cannot see that the lead went to this page.

EDIT: As an update, it can fully track the visitor’s movements as an anonymous contact. I just checked and it sees the IP and everything, for some reason it just isn’t updating the email address contact inside Mautic.

As yet another update now when I try to go to my dashboard I have a “500 internal server error”, yet all pages inside my dashboard load fine…?

I’m very new to this and feel overwhelmed, it seems like one issue after another at every step with Mautic.

This is what the logs say:

[2022-10-16 22:06:28] mautic.CRITICAL: Uncaught PHP Exception Symfony\Component\Debug\Exception\FatalThrowableError: “method_exists(): Argument #1 ($object_or_class) must be of type object|string, null given” at /home/luminouscityrp.com/public_html/app/bundles/CoreBundle/EventListener/DashboardSubscriber.php line 101 {“exception”:“[object] (Symfony\Component\Debug\Exception\FatalThrowableError(code: 0): method_exists(): Argument #1 ($object_or_class) must be of type object|string, null given at /home/luminouscityrp.com/public_html/app/bundles/CoreBundle/EventListener/DashboardSubscriber.php:101)”} {“hostname”:“webserver”,“pid”:160286}

Here is an idea:

  1. make db backup
  2. delete the audit log table in your instance and see if it’s fixed.

I had the same issue not so long time ago. I didn’t have time to retrace the problem, but this fixed it.
Audit log is used to backtrack what happened to a contact record. It has no other functionality.

WRONG ADVICE WARNING
Just delete the contents of this table. not the whole table

1 Like

Okay will try, I greatly appreciate you helping!

Okay, I tried this and everything in Mautic loads except for the dashboard still.

The server logs say this:

[2022-10-17 07:54:41] mautic.CRITICAL: Uncaught PHP Exception Doctrine\DBAL\Exception\TableNotFoundException: “An exception occurred while executing ‘SELECT a0_.user_name AS user_name_0, a0_.user_id AS user_id_1, a0_.bundle AS bundle_2, a0_.object AS object_3, a0_.object_id AS object_id_4, a0_.action AS action_5, a0_.details AS details_6, a0_.date_added AS date_added_7, a0_.ip_address AS ip_address_8 FROM audit_log a0_ WHERE a0_.object <> ? ORDER BY a0_.date_added DESC LIMIT 3’ with params [“category”]: SQLSTATE[42S02]: Base table or view not found: 1146 Table ‘lumi_mautickewf34043t.audit_log’ doesn’t exist” at /home/luminouscityrp.com/public_html/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/AbstractMySQLDriver.php line 61 {“exception”:“[object] (Doctrine\DBAL\Exception\TableNotFoundException(code: 0): An exception occurred while executing ‘SELECT a0_.user_name AS user_name_0, a0_.user_id AS user_id_1, a0_.bundle AS bundle_2, a0_.object AS object_3, a0_.object_id AS object_id_4, a0_.action AS action_5, a0_.details AS details_6, a0_.date_added AS date_added_7, a0_.ip_address AS ip_address_8 FROM audit_log a0_ WHERE a0_.object <> ? ORDER BY a0_.date_added DESC LIMIT 3’ with params ["category"]:\n\nSQLSTATE[42S02]: Base table or view not found: 1146 Table ‘lumi_mautickewf34043t.audit_log’ doesn’t exist at /home/luminouscityrp.com/public_html/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/AbstractMySQLDriver.php:61, Doctrine\DBAL\Driver\PDO\Exception(code: 42S02): SQLSTATE[42S02]: Base table or view not found: 1146 Table ‘lumi_mautickewf34043t.audit_log’ doesn’t exist at /home/luminouscityrp.com/public_html/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDO/Exception.php:18, PDOException(code: 42S02): SQLSTATE[42S02]: Base table or view not found: 1146 Table ‘lumi_mautickewf34043t.audit_log’ doesn’t exist at /home/luminouscityrp.com/public_html/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOStatement.php:117)”} {“hostname”:“webserver”,“pid”:86896}

I should have said it differently… Not delete the whole table, just delete the records in it…
I’m really sorry,
Can someone plz chime in, how to re-create the table? @mzagmajster ?

Or can you roll back, @seoninja

Column Type Comment
id bigint(20) unsigned Auto Increment
user_id int(11)
user_name varchar(191)
bundle varchar(50)
object varchar(50)
object_id bigint(20) unsigned
action varchar(50)
details longtext NULL (DC2Type:array)
date_added datetime
ip_address varchar(45)

Indexes

PRIMARY id
INDEX object, object_id
INDEX bundle, object, action, object_id
INDEX date_added

Yes I have rolled back to before deleting the database.
So am I supposed to delete the columns you mentioned above?

I don’t know if this is helpful but as an update I cannot create emails either. When I try to click on “Update” in a campaign below the email I get another 500 internal server error.

Here is what the server log has to say:

[2022-10-17 10:07:24] mautic.CRITICAL: Uncaught PHP Exception Doctrine\DBAL\Exception\NotNullConstraintViolationException: “An exception occurred while executing ‘INSERT INTO audit_log (user_id, user_name, bundle, object, object_id, action, details, date_added, ip_address) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)’ with params [1, “Gabriel Miller”, “email”, “email”, 17, “create”, “a:4:{s:12:"dateModified";a:2:{i:0;N;i:1;s:25:"2022-10-17T10:07:24-04:00";}s:7:"subject";a:2:{i:0;N;i:1;s:11:"Temp Access";}s:7:"utmTags";a:2:{i:0;a:0:{}i:1;a:4:{s:9:"utmSource";N;s:9:"utmMedium";N;s:11:"utmCampaign";N;s:10:"utmContent";N;}}s:8:"template";a:2:{i:0;N;i:1;s:5:"blank";}}”, “2022-10-17 14:07:24”, “71.186.230.121”]: SQLSTATE[HY000]: General error: 1364 Field ‘id’ doesn’t have a default value” at /home/luminouscityrp.com/public_html/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/AbstractMySQLDriver.php line 125 {“exception”:“[object] (Doctrine\DBAL\Exception\NotNullConstraintViolationException(code: 0): An exception occurred while executing ‘INSERT INTO audit_log (user_id, user_name, bundle, object, object_id, action, details, date_added, ip_address) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)’ with params [1, "Gabriel Miller", "email", "email", 17, "create", "a:4:{s:12:\"dateModified\";a:2:{i:0;N;i:1;s:25:\"2022-10-17T10:07:24-04:00\";}s:7:\"subject\";a:2:{i:0;N;i:1;s:11:\"Temp Access\";}s:7:\"utmTags\";a:2:{i:0;a:0:{}i:1;a:4:{s:9:\"utmSource\";N;s:9:\"utmMedium\";N;s:11:\"utmCampaign\";N;s:10:\"utmContent\";N;}}s:8:\"template\";a:2:{i:0;N;i:1;s:5:\"blank\";}}", "2022-10-17 14:07:24", "71.186.230.121"]:\n\nSQLSTATE[HY000]: General error: 1364 Field ‘id’ doesn’t have a default value at /home/luminouscityrp.com/public_html/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/AbstractMySQLDriver.php:125, Doctrine\DBAL\Driver\PDO\Exception(code: HY000): SQLSTATE[HY000]: General error: 1364 Field ‘id’ doesn’t have a default value at /home/luminouscityrp.com/public_html/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDO/Exception.php:18, PDOException(code: HY000): SQLSTATE[HY000]: General error: 1364 Field ‘id’ doesn’t have a default value at /home/luminouscityrp.com/public_html/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOStatement.php:117)”} {“hostname”:“webserver”,“pid”:107433}

The error:

I cannot save any updates to campaigns either.

Hi,

something very strange is happening. I think your audit log table is not complete since you rolled back.

  1. Can you maybe drop the audit_log table and import it from backup?
  2. If above is not possible, do you have a full backup of database and are you able to drop the entire database and import entire database back?

EDIT: Now when I refreshed it a second time it works, without the 500 error! Nothing new in the server logs either. Going to try and test the page visit tracking to see if it is now working.


I didn’t drop it before, I tried to overwrite it. I dropped the database and imported it, still getting the 500 error.

Here is what the server log says:

[2022-10-18 02:21:57] mautic.CRITICAL: Uncaught PHP Exception Doctrine\DBAL\Exception\NotNullConstraintViolationException: “An exception occurred while executing ‘INSERT INTO audit_log (user_id, user_name, bundle, object, object_id, action, details, date_added, ip_address) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)’ with params [1, “Gabriel Miller”, “user”, “security”, 1, “login”, “a:1:{s:8:"username";s:14:"localrankninja";}”, “2022-10-18 02:21:57”, “71.186.230.121”]: SQLSTATE[HY000]: General error: 1364 Field ‘id’ doesn’t have a default value” at /home/luminouscityrp.com/public_html/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/AbstractMySQLDriver.php line 125 {“exception”:“[object] (Doctrine\DBAL\Exception\NotNullConstraintViolationException(code: 0): An exception occurred while executing ‘INSERT INTO audit_log (user_id, user_name, bundle, object, object_id, action, details, date_added, ip_address) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)’ with params [1, "Gabriel Miller", "user", "security", 1, "login", "a:1:{s:8:\"username\";s:14:\"localrankninja\";}", "2022-10-18 02:21:57", "71.186.230.121"]:\n\nSQLSTATE[HY000]: General error: 1364 Field ‘id’ doesn’t have a default value at /home/luminouscityrp.com/public_html/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/AbstractMySQLDriver.php:125, Doctrine\DBAL\Driver\PDO\Exception(code: HY000): SQLSTATE[HY000]: General error: 1364 Field ‘id’ doesn’t have a default value at /home/luminouscityrp.com/public_html/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDO/Exception.php:18, PDOException(code: HY000): SQLSTATE[HY000]: General error: 1364 Field ‘id’ doesn’t have a default value at /home/luminouscityrp.com/public_html/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOStatement.php:117)”} {“hostname”:“webserver”,“pid”:218316}

A new problem is now occurring. The contacts are no longer getting assigned to the “pending survey” segment when they are added to Mautic. I double checked everything in WordPress but it is still set up the same.

This is an issue because the segmenting campaign will not run if they are not added to that pending segment.

Now this is also happening on WordPress:

image

This is what it is saying in the server logs:

[2022-10-18 02:37:16] mautic.CRITICAL: Uncaught PHP Exception Doctrine\DBAL\Exception\NotNullConstraintViolationException: “An exception occurred while executing ‘INSERT INTO audit_log (user_id, user_name, bundle, object, object_id, action, details, date_added, ip_address) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)’ with params [0, “System”, “lead”, “lead”, “156”, “create”, “a:2:{s:11:"ipAddresses";a:2:{i:0;s:0:"";i:1;s:14:"71.186.230.121";}s:6:"fields";a:5:{s:19:"mwb_last_order_stat";a:2:{i:0;N;i:1;s:4:"null";}s:22:"mwb_last_order_ff_stat";a:2:{i:0;N;i:1;s:4:"null";}s:18:"mwb_order_monetary";a:2:{i:0;N;i:1;s:4:"null";}s:19:"mwb_order_frequency";a:2:{i:0;N;i:1;s:4:"null";}s:17:"mwb_order_recency";a:2:{i:0;N;i:1;s:4:"null";}}}”, “2022-10-18 02:37:16”, “71.186.230.121”]: SQLSTATE[HY000]: General error: 1364 Field ‘id’ doesn’t have a default value” at /home/luminouscityrp.com/public_html/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/AbstractMySQLDriver.php line 125 {“exception”:“[object] (Doctrine\DBAL\Exception\NotNullConstraintViolationException(code: 0): An exception occurred while executing ‘INSERT INTO audit_log (user_id, user_name, bundle, object, object_id, action, details, date_added, ip_address) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)’ with params [0, "System", "lead", "lead", "156", "create", "a:2:{s:11:\"ipAddresses\";a:2:{i:0;s:0:\"\";i:1;s:14:\"71.186.230.121\";}s:6:\"fields\";a:5:{s:19:\"mwb_last_order_stat\";a:2:{i:0;N;i:1;s:4:\"null\";}s:22:\"mwb_last_order_ff_stat\";a:2:{i:0;N;i:1;s:4:\"null\";}s:18:\"mwb_order_monetary\";a:2:{i:0;N;i:1;s:4:\"null\";}s:19:\"mwb_order_frequency\";a:2:{i:0;N;i:1;s:4:\"null\";}s:17:\"mwb_order_recency\";a:2:{i:0;N;i:1;s:4:\"null\";}}}", "2022-10-18 02:37:16", "71.186.230.121"]:\n\nSQLSTATE[HY000]: General error: 1364 Field ‘id’ doesn’t have a default value at /home/luminouscityrp.com/public_html/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/AbstractMySQLDriver.php:125, Doctrine\DBAL\Driver\PDO\Exception(code: HY000): SQLSTATE[HY000]: General error: 1364 Field ‘id’ doesn’t have a default value at /home/luminouscityrp.com/public_html/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDO/Exception.php:18, PDOException(code: HY000): SQLSTATE[HY000]: General error: 1364 Field ‘id’ doesn’t have a default value at /home/luminouscityrp.com/public_html/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOStatement.php:117)”} {“hostname”:“webserver”,“pid”:220504}

The error is def connecter to the audit log, but not because you deleted and restored it. There is a fundamental problem with it.

I see. Is there any way to fix it or get it working? I’m not a developer so this kind of stuff is overwhelming for me.

Hi,

I am curious, can you please share the output of the following statement (execute it on mautic database):

show create table audit_log;

The error above sounds like id field might be configured wrong. Field id should be primary key of the table and configured as auto increment column.

Other ways to potential solution:

  1. How customized is your mautic (plugins, additional custom fields etc.)? Are you able to export just the data from the backup, install brand new mautic and then just import the data into the new mautic instance?
  2. Consider getting professional help, this might be your best bet.

Hope it helps.

Regards, M.

Thanks for the reply.

This is the output of that query:

image

I don’t have any plugins in Mautic. The WordPress plugin I used to sync it did add some custom fields I believe.

I will try installing a new Mautic and see if that fixes the problem.

I need to see all text under “Create Table” column, can you copy and paste it to the post?

If you are going to reinstall mautic make sure to create a complete backup of what you currently have (database + source).

I would ask in completelly another direction: does Mautic4 work on php8 ? In the early 2022 I saw that php8 is not yet supported by Mautic. I was glad to see that the upcomming version 5 of Mautic will support php8.
You have still Mautic4; would the errors be because of php version?

Yes, it does