Page Visit Tracking Not Working

I double checked this, it supposedly does work with PHP8. I’ve been having issues with Thrive plugins on my websites on this server as well (self-hosted), and I reached out to their plugin support.

I think it’s more of an issue with CyberPanel, so I’m going to be reaching out to them and seeing what the deal is.

Finally got this working!

Went down the rabbit hole of asking on CloudFlare forums, here, and CyberPanel forums.

Turns out using PHP 7.4 fixed the issue.

1 Like

UPDATE: And now for some reason it stopped working again. No changes have been made in Mautic. I’ve updated WordPress and my plugins over time, but that’s it.

I noticed it because a lot of leads were added, but they didn’t get segmented properly. At first I thought to myself that “they must have not completed the survey.” Then I tried myself in Incognito and sure enough, it didn’t add me even after the page visit. This is super frustrating. Obviously my setup inside Mautic is correct, since it worked before.

I’m not sure if this has anything to do with it but it says that some of my segments haven’t been updated rebuilt for 278 hours:

Check that your cron for segment update is working (php bin/console mautic:segments:update)

You were spot on! Turns out something is wrong with Cron. This is the output I got when running the command:

I don’t know what messed it up or how to solve this. Any idea on what is going on?

Looks like your database credentials might be invalid. Ensure that database credentials in app/config/local.php are valid.

Thanks for the reply.

I just opened the file in Nano, it’s the same as it is in my control panel thingie. I even tried to change the password to what’s in the Mautic file since that’s the one thing I didn’t know to find otherwise, it said it can’t be the same password so everything is correct with the database credentials.

I did read online to try clearing Mautic cache when I did, it’s still not working.

I wonder how it just stopped working. I’m worried that even if we fix it, this will happen again in the future. Hopefully once we know what it is, we can prevent that. It’s just so weird that no changes were made and it just stopped working out of nowhere.

If you try to login to mysql server with credentials to in app/config/local.php does it work?

Yes it does, I’m able to log in with PHPMyAdmin with no issues.

On the second look, it mght be that you do not have correct php mysql driver installed. Please make sure correct version of php-mysql extension is installed.

UPDATE: I did a bit of Googling. I just tried to do apt-get install php-mysql on my web server. That seems to have fixed that issue. I can now run the cron mautic:segments:update command successfully.

However, the page visit is still not segmenting. Mautic can see anonymous users that have visited the page, but it isn’t moving the segment of a contact.

I tried manually running the cron commands after I did the survey, but it still didn’t add them.

I’m still super confused as to how it worked and one didn’t. It had to have had that MySQL installed before, right? How did it just uninstall itself? This makes no sense to me, but my Linux and knowledge in this area is very limited.

UPDATE2: It seems like the campaign actions are pending.

I did some research, Mautic is actually popping up some errors in the log.

[2022-11-21 18:41:02] mautic.WARNING: Command mautic:campaigns:rebuild exited with status code 1 {“hostname”:“webserver”,“pid”:5457}
[2022-11-21 18:41:02] mautic.NOTICE: TypeError: flock(): Argument #1 ($stream) must be of type resource, bool given (uncaught exception) at /home/ line 143 while running console command mautic:segments:update {“hostname”:“webserver”,“pid”:5455}
[2022-11-21 18:41:02] mautic.WARNING: Command mautic:segments:update exited with status code 1 {“hostname”:“webserver”,“pid”:5455}

Maybe it got uninstall during an update (I really cannot tell)?

About the rebuild error. Have you tried clearing the cache with rm -rf var/cache/dev/* var/cache/prod/*

and resetting permissions on files and folders and execute the script as that user

I see, that makes sense. In ProxMox it’s said at the bottom it’s done some “package updates.” My linux knowledge is very limited but that may very well have been what messed it up.

I ran the clear cache command did a permissions fix inside CyberPanel, I’m not sure if that’s the right way to do it or not. This is what I hit:

it’s still not tracking the page visits. Is there a fix permissions command to run inside the O.S. itself?

I appreciate all the help, thanks!

Since your server is managed by provider I think it executes shell commands when you click fix permissions.

Not sure what is the reason for failing script. When you execute the script from the terminal, does it show anytinhg else other then the error from the log?

What is shown if you try to run the scripts with -v flag?

After doing the apt-get to re-install PHP the cron commands work, even with -v:

Page tracking is still not working.

The server has stopped with the error in the logs once I removed the cronjob from “crontab -e” in the O.S. and left only the cron jobs in CyberPanel.

But page tracking is still not working.

Glad to see that you got the crons working.

Now as for the page tracking… because I am not quite sure at this point, what do you mean by page tracking.

Can you please explain in a bit more detail where do you see page tracking not working and maybe attach a screenshot?

Maybe you mean, that page visit based campaign actions are not working?

Yes, it is not working but it worked before. No changes were made and all of a sudden it stopped working. I’ve tried re-creating it a few times to see if I can get it to work.

Here’s what it looks like:

It worked at one point as seen by the statistics:

Here is the setup in detail:

When a subscriber opts-in on my website, they are directed to a survey asking what their knowledge level is. This is so I can talk to newbies differently opposed to intermediate SEOs.

Then they land on different thank you pages. Once they land on those it is supposed to change their segment so they get added to the relevant campaign.

It’s not changing their segments.

Hi, couple of things:

can you please…

  1. paste your cron config
  2. research links: < Troubleshooting Campaigns | Mautic > and < Campaign does not trigger a page hit after successfully sending an email - #4 by robm > to see if they are of any help
  3. Create another campaign with just one page hit and see if it works.

Here is the cron config:

I stumbled across that post when I was first Googling before I posted my question. I’ve tried the URL with the wildcard and other ways:

None of these methods are working.

Interestingly enough, Mautic can in fact tell that those pages were visited with anonymous users:

Yet it somehow doesn’t register that the contact did this so it doesn’t update them.

From what I can understand page tracking is working.

I tried doing it via segmenting filters and I also tried creating a new campaign. These things didn’t work.