Can mautic dwc show up on external webpages

Hi, can mautic dwc show up on external webpages? I’m testing a mautic campaign and it works when my form redirects to a mautic landing page, but not when it directs to an external html page. I have a picture included of my html code with the mautic tracking object and dwc slot called.

Hi, yes, it would work.
you need 2+2 ingredients to make it work:

2 Obvious ingredients:

  1. Mautic tracking code on that page (I can see it’s done)
  2. DWC code included (it’s also done)

+2 secret ingredients:

  1. You need to make sure you don’t have CORS issue. This happens, if your server is m.mautic.com and your external page is whatever.com. If whatever.com is might be set in a way that all external scripts are blocked. You can see an error in the browser javascript console. (Something like CORS blabla error blaba not permitted.) You should have HTTPS on both sites.

  2. You need to test this with a browser, where you never logged in as admin into Mautic. Incognito might not be enough. The reason is, if you have logged in as admin before, then you have the admin cookie and DWC is not shown to you.

Hi, thank you for your reply but I’m still having problems.
I’ve confirmed that both sub domains are on the same domain and I’ve also tested on multiple browsers that have not been logged in to Mautic.
The sites were on different domains but are on the same one now, could that be the problem?

here’s the code for the form page:

<!DOCTYPE html>
<html>
<head>
<title>Page Title</title>
<script>
    (function(w,d,t,u,n,a,m){w['MauticTrackingObject']=n;
        w[n]=w[n]||function(){(w[n].q=w[n].q||[]).push(arguments)},a=d.createElement(t),
        m=d.getElementsByTagName(t)[0];a.async=1;a.src=u;m.parentNode.insertBefore(a,m)
    })(window,document,'script','https://[subdomain]/mtc.js','mt');

    mt('send', 'pageview');
</script>
</head>
<body>

    <script type="text/javascript" src="//[subdomain]/form/generate.js?id=3"></script>

</body>
</html>

Have you confirmed you are not having CORS issue?

Look in the browser console for any error or if you are having CORS issue.

Hi. No, there’s no CORS issue either.

I don’t know if it will make any difference but my Mautic tracking script is inside the body tag which works for me.

I noticed that yours is inside the head tag, try moving it inside the body tag and see if that fixes it.

Moving the mautic script to the body did not fix the issue either.

Do you have any error in console?

ah, yes I do.

These are not related, just the regular Onesignal problem

This’s is how I do mautic dynamic content on WordPress pages

<div data-slot="dwc" data-param-slot-name="myslotname">
  <h3>Header text</h3>
  <p>paragraph text</p>
  <script type="text/javascript" src="//mymautic.com/form/generate.js?id=7"></script>
</div>

worth to check your CORS. don’t end your domain with slash ( / )

hope this works

Hi, moving the script below the

element didn’t help. And there’s still no CORS issue.

Can you plz share this screen?

Hi,
You are using campaign based dwc, not filter based. (See switch “Is campaign based?”)
As a result you don’t have a slot name. The DWC will be shown as a campaign step (ONCE), what you have to add in the campaign editor.
Is this what you want?
Joey

1 Like