Focus items in campaigns not working

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:

2 Likes

Just wondering here, is it possible to show focus items without being tied to a campaign?

Still having the same problem, tried in different browsers, focus items doesnā€™t load.

Can anyone share a solution to this?

Hi There,

Yes you can have focus items outside of a campaign, all you need to do is make sure you have inserted the code in the page you want it to load, or to do it via google tag manager.

A few points to keep in mind when testing:

  1. Make sure you are not logged into Mautic when testing.
  2. Make sure your CORS is enabled to the site you want to focus item to load.

if it is not loading are you seeing any errors in the the console or any logs ?

Off topic to your question, but on topic for this post I have an update on the config of nginx

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

Hello Joey,

Iā€™m jumping in here because I think I have a similar problem.

Iā€™m also currently testing the focus items in a campaign and Iā€™m not getting any output on the page. If I include the focus item script it works without any problems.

I have defined a very simple campaign: Contact Segment ā†’ Page Visit (with URL: *) ā†’ Show Focus Item.

image

image

In the contact, the focus item is also given to me as ā€œCampaign action triggeredā€.

However, I donā€™t see anything on the page. Iā€™m testing it locally in an incognito browser, have CORS turned off. I donā€™t see any errors in the console. The normal event is output in the network requests when the page is accessed.

Do you have any ideas as to why the focus item isnā€™t being visible for me?

Best regards

Timo

Are you using the same browser for testing as admin? Remember: an admin gets an admin cookie, and tracking wonā€™t work. It means, that youā€™ll never fulfill the ā€˜visited pageā€™ event.

Try to clear the cookies, and or use another browser for testing.

Hi Joey,

thanks for your reply. I use the same browser but do the testing in an inkognito tab. So I think there should be no cookie problem.

Can you find the test contact in Mautic among anonymous contacts and paste here the list of events?

Hello Joey,

Thank you for your feedback signal. I forgot the picture yesterday.

In my test case, however, it is not an anonymous contact but a segment with a group of specific contacts. So one of these contacts, Iā€™m logged in incognito and unfortunately I donā€™t see the focus item.

But if you are in incognito, then how do you know, that this contact is identified and the page view is acknowledged?

Hello Joey,

Thank you for your feedback signal. Yes, I can understand your query, please excuse my inaccurate explanations.

The reason is that I log in to our site and the user is identified through it.

I send the userā€™s UUID with the tracking data:

trackingData = {
    pb_uuid: app.$auth.user.id,
};
mt('send', 'pageview', trackingData);

Accordingly, we have a custom field pp_uuid which is publicly updatable and also a unique identifier.

So if I log in as a user and then move around the page, these page views are recognized and displayed in the contact in Mautic.

I just saw in the tracking script request that it appears to contain data for the focus item. Unfortunately nothing/no focus item is displayed.