If you are using D365 Marketing, and are trying to make the most from all the functionality, you’ve likely set up a marketing website record and generated tracking code to add to your organisations corporate website. This means you can track visits to the site, most of which will be anonymous, but with named visits showing when a Contact in D365 interacts with the site (assuming they have cookies in their browser allowing this). However, if you’ve set up the tracking code using Google Tag Manager (which is good best practice), you might have noticed something strange this in your visits. This is where a series of visits show up with a url relating to Google Tag Manager (https://gtm-msr.appspot.com/render2?id=GTM-PLUS-YOUR-ID). What causes them and how do you get rid of them by filtering out Google Tag Manager Traffic? Read on for details.
Thanks to this video I found here from Measure School, it explains perfectly how and why it happens. Their example was based on tracking when using Facebook Pixel, so I applied the same logic here. First thing, you have the tracking code for your website when you create the marketing website in D365.
Then in Google Tag Manager you likely created a tag with the Custom HTML type that fires on all pages of your website. Great!
However, what we are now going to do is split that up and create two tags that fire on all pages, both using the tag type of Custom HTML. In the first one we are going to add the items that are wrapped in the DIV tags. So the first line, then the last lines is what you need. You can see what you need below, but you will have a different div id, data-website-id and data-hostname. Make sure you use YOUR correct lines of the tracking code.
<div id="dWftIH4jZfZKXBmyVMsXR-9Zc60sbXrqbOBIVAeM9Fzo"></div> <div class="d365-mkt-config" style="display:none" data-website-id="WftIH4jZfZKXBmyVMsXR-9Zc60sbXrqbOBIVAeM9Fzo" data-hostname="b3db011fec024820bd80f2114e60fabd.svc.dynamics.com"></div>
Add it in to a Custom HTML tag like this.
You should then be able to copy and paste this in to a new Custom HTML tag. Massive massive thank you to my brother, Owen Rumney, for the assist (AKA writing it) with the script logic.
This won’t remove any of the previous GTM visits you’ve captured, but it should stop them moving forwards. Again, as we’ve only done this in GTM for the D365 Marketing tracking code, it also shouldn’t impact anything else you have set up from a tag or trigger perspective. Hope this helps!