Focus items in campaigns not working

Your software
My Mautic version is: 2.15

Your problem
My problem is: I want to display a focus item based on a few criteria, so I insert it inside a campaign.
The campaign is: Segment > Page Visit > Action: Display Focus Item.

I can see in the contact details that the Campaign portion of it is being processed, however the focus item does not load on the page.
If I go to the landing page and manually add the focus item’s javascript, the focus item loads just fine. It simply won’t load via the campaign.

Steps I have tried to fix the problem: I created several times different contacts, landing pages, segments and campaigns, but still it doesn’t work.

Check the browser console (F12) do you see any errors?

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

Hello!

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 https://mymautic.com/. (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)] https://mymautic.com/focus/4.js

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: https://mydomain.com/index.php/focus/1.js 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 https://mydomain.com. 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.