web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
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?

I have the same question (0)
  • cloflyMao Profile Picture
    25,210 on at

    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.

  • Stripey Profile Picture
    45 on at

    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

  • Stripey Profile Picture
    45 on at

    Test reply?

  • Verified answer
    cloflyMao Profile Picture
    25,210 on at

    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
    45 on at

    Thanks Clofly, good to know.

  • Ahmed Poshi Profile Picture
    25 on at

    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!

  • Hunt_Morris Profile Picture
    5 on at

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

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > Customer experience | Sales, Customer Insights, CRM

#1
Tom_Gioielli Profile Picture

Tom_Gioielli 73 Super User 2025 Season 2

#2
Gerardo Rentería García Profile Picture

Gerardo Rentería Ga... 43 Most Valuable Professional

#3
Daniyal Khaleel Profile Picture

Daniyal Khaleel 32 Most Valuable Professional

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans