Focus items in campaigns not working

No, I don’t see any errors.

Hi I am facing the same problem! Could somebody please suggest any way to make it possible?

are you testing this in a private or separate browser that you are not logged into Mautic ?

Are you seeing any errors in your logs,

Are you seeing any decisions or actions changing in campaign log ?

1 Like

Hi, mikew I am testing from a different machine in which is using a different network. I see that the campaign action is triggered but the Focus item does not show. I do not see any errors in my log.

This is how My campaign looks:

My CORS setting is plain, without any valid domain mentioned.

Just to let you know further that I am aiming to show different focus items for different segments and I leaned from the informations available online that it is possible to do that through Campaigns, hence I did not copy the focus installation code in my website. Or is it required that I copy the focus installation code?

Thanks a lot for the support! It would be a great help if you or anyone could help me solve this problem.

I recreated your campaign and had the same issue as you.

I then remembered that my browser is set to block pop-ups, I removed that setting, and then the focus item worked.

1 Like


If you don’t copy the focus item script to your page that is totally fine. Your tracking script will fire the right cofust item.

The focus item will show only once with your setting and then wait’s for your decision.
In order to understand what happens is to look at the campaign events:

If you want to show the focus item more, you need to make a jump in the campaign back to ‘visit’s page’. Here is a video about how to do it from a previous Lagos Meetup.

1 Like

Thank you robm, I am not using any pop-up blocker in my web browser, still no focus item is showing however from the contacts log I can see that the campaign action triggered.

Still focus item is not showing.

HI joeyk, Thank you for your kind information, from your post my one of my confusion is solved that I do not have to copy the focus tracking code in my website when I am trying to show focus item through Campaign.

I have created a segment based on web page visit. An anonymous contact gets into the segment after visiting a certain page more that 3 times lets say. In my campaign I have taken the segment in the beginning and set up on showing focus item after visiting the same page.

Screenshot 2021-07-05 at 15.04.03

So far, the campaign triggers but the focus item does not show.

What am I doing wrong here? I have been stuck for a couple of weeks on this same problem. Let me know if you need any further infos. Thanks in Advance.

I see the following errors in my logs now:

Screenshot 2021-07-06 at 14.39.37

Hmm. Is your https valid? Cors restrictions are turned off?

1 Like

Thanks, it works after CORS restrictions are turned off.

I have been testing this and I am having a strange issue. On my site normal focus items come up no problem.

the only thing is what I needed to do to get it working was add in index.php after the base domain and before /focus/1.js

In my mautic site url it is simply (without index.php)

So now when I am calling the focus item through the campaign I can see in the console that it is unable to load the focus item [Failed to load resource: the server responded with a status of 404 (Not Found)]

I am running mautic on Ubuntu 20.4 with Nginx Server.

Any ideas ?

Smells like a .htaccess issue. Do you see the file in the root?

Running Nginx, so I am not sure about .htaccess.

When you ask whether I see the file in root, can you explain a bit more of where you mean and what ?

Should I see the 4.js file in /mautic/app/ ?

But maybe if can be a nginx conf setting ?

in my conf I do see something relating to .js
location / {
# try to serve file directly, fallback to app.php
try_files $uri /index.php$is_args$args;

    location /INT {
    auth_basic "Admin Area";
    auth_basic_user_file /etc/nginx/.htpasswd;

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

and as I said standard focus items are working, however I did have to add in index.php

ok @joeyk

I think I understand what you mean.

When I call one of my exit intent pop-ups I put in the url: and it outputs some code there on the page for me.

When I do this with the other URL that I am seeing the error in I get a 404. However if I add in index.php/focus/4.js then I see the code on the page…

Really strange as my site url is and not Page Not Found
I have also tried with both here as well

Inside wp-mautic I have tried with both index.php and without, does not seem to make the difference.

What I meant is: do you have a .htaccess file in the mautic root dir?
That is repossible about rewrite usually. As you know I’m an apache, not nginx…

Hey Joey,

Yes there is an .htaccess file there.

As far as I know that file is responsible about rewriting path (besides nginx settings). You should look for “nginx rewrite index.php htaccess” searches in Google.

I am revisiting this issue as I still have not been able to resolve it and it is driving me crazy :-(.

Are there any nginx people that have experienced this?
We are running a focus item inside a campaign and it is not showing up as would be expected.
I am wondering if this might be a nginx configuration problem.
This is what I am seeing in the console

@robm and myself sat and debugged this issue and managed to get things working.

There are two issues here:

  1. In the page visited Mautic is always expecting a trailing slash /
  2. If you are running nginx and have used the configuration set out in linuxbabe article he is only allowing for 1.js to be passed through in the server rules:
   location ~ /(mtc.js|1.js|mtracking.gif|.*\.gif|mtc) {
       # default_type "application/javascript";
       try_files $uri /index.php$is_args$args;

Now my regex is not good enough to mess around with this so all I did was amend to this line the different focus items I wanted to allow to be served by the nginx server as follows:

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

I hope this helps others :-). Thanks @robm for assisting and finding the trailing slash :slight_smile: