*** NOTE: ALL INFORMATION IS ACCURATE AT DATE OF PUBLISHING ***
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.
Now look at the Advanced Settings. We want to make sure the tag fires with a higher priority than the next tag we create, and also that it fires once per page. I set my priority to 2 but it just needs to have a higher number than your other tag firing priorities. The higher the number the higher the priority.
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.
Now go in to the Advanced Settings for this tag. I might be able to get away without using the priority again, but this time I set it as 1 so it’s a lower priority than the first tag with the DIVS. However, what I did make sure is that it fires once per page, and also that the D365 Marketing DIVS tag fires before this one and doesn’t fire is that tag fails or is paused. If we don’t make sure they are in this order and the script runs, the web page visit doesn’t know which D365 environment to link it back to, so you can end up with missing website visits.
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!
Check out the latest post:
Creating Personalised Thank You Pages For Realtime Marketing Forms
This is just 1 of 426 articles. You can browse through all of them by going to the main blog page, or navigate through different categories to find more content you are interested in. You can also subscribe and get new blog posts emailed to you directly.