Skip to main content

Notifications

Customer experience | Sales, Customer Insights,...
Answered

How to integrate the Dynamics Marketing website tracking code?

(0) ShareShare
ReportReport
Posted on by 45

We're really not certain about how to successfully integrate your javascript snippet onto our pages in order to return Insights data from the website?

Using the default Javascript code that is displayed under our website and which looks similar to this -

<!--Dynamics Marketing Website Tracking Tag-->
<div id="XX"></div><script src="">mktdplp102cdn.azureedge.net/.../ws-tracking.js class="d365-mkt-config" style="display:none" data-website-id="XXX" data-hostname="XXX.svc.dynamics.com"></div>
<!--End Dynamics Marketing Website Tracking Tag-->

We have attempted to firstly integrate this into our Google Tag Manager container and then to just place it on the actual HTML page, first within the top of the <body> tag (it is not just javascript but is a <div> element so cannot sit within the <head> of the HTML) and then at the end of the <body> element.

None of these implementations work?

Can you advise on where we need to place your javascript code in order to get it firing correctly?

  • Hunt_Morris Profile Picture
    Hunt_Morris 5 on at
    RE: How to integrate the Dynamics Marketing website tracking code?

    This is why I'm never bothering to learn actual web development. Looks super hard.

  • Ahmed Poshi Profile Picture
    Ahmed Poshi 25 on at
    RE: How to integrate the Dynamics Marketing website tracking code?

    Hi,

    What if just want to track page visits only without capturing any form.

    - I created a Marketing website and then copied the JS code and pasted it into the external page, but I can't get any insights.

    - And will this affect if the marketing is installed on the powerapps portal rother than hosted on the external CMS!

  • Stripey Profile Picture
    Stripey 45 on at
    RE: How to integrate the Dynamics Marketing website tracking code?

    Thanks Clofly, good to know.

  • Verified answer
    cloflyMao Profile Picture
    cloflyMao 25,202 on at
    RE: How to integrate the Dynamics Marketing website tracking code?

    Hi Stripey,

    Yes, at least a form is required to be embedded on the page.(Actually the really required thing is form-loader.js)

    For a real example: when using form capture feature, it only show us form-loader.js in the popup.

    form_2D00_loader.JPG

    Even if we can find that ws-tracking.js has been also generated after opening the form page record of the lookup field, however, insights can be return when there is only form-loader.js embedded on the page.

    rr.JPG

    Generally speaking, we put <div> into body section and <script> into header section. In other word, <div> and <script> of automatically generated script can be put separately.

    page.JPG

    1667.loader.JPG

  • Stripey Profile Picture
    Stripey 45 on at
    RE: How to integrate the Dynamics Marketing website tracking code?

    Test reply?

  • Stripey Profile Picture
    Stripey 45 on at
    RE: How to integrate the Dynamics Marketing website tracking code?

    Hi,

    We do not want forms on each page, unfortunately? As we understood it the website tracking snippet would return insights on all visits.

    Are you saying that if we embed a dynamics marketing form on a page then that page will return insights?

    Also, can you confirm the way in which we need to actually embed this tracking <div> element on to the page please? this is not entirely clear in the documentation.

    Thank you

  • cloflyMao Profile Picture
    cloflyMao 25,202 on at
    RE: How to integrate the Dynamics Marketing website tracking code?

    Hi Stripey,

    According to the my test result from this thread:

    https://community.dynamics.com/365/marketing/f/dynamics-365-for-marketing-forum/415820/customer-journey-with-if-then-visited-marketing-page

     By default there is ws-tracking.js, however, insights data were only generated after embedding a marketing form to marketing page.

    So it would be concluded that ws-tracking.js should work together with form-loader.js to track page visitors interactions.

    You could embed the form-loader.js and hide the form using CSS to do tracking.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Vahid Ghafarpour – Community Spotlight

We are excited to recognize Vahid Ghafarpour as our February 2025 Community…

Congratulations to the January Top 10 leaders!

Check out the January community rock stars...

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 292,160 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 230,962 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans