How to Build a Segment of Repeat Website Visitors in Dynamics 365 for Marketing

Dynamics 365 for Marketing is a rich app to support your marketing automation purposes. You can build customer journeys, segments, emails, landing pages, events and more. See these blog posts for more.

Dynamics 365 can also collect information about how your website(s) is used by its individual visitors. To enable the feature, Dynamics 365 generates JavaScript code that you must add to each page that you want to monitor (usually an admin would do this site-wide by using your CMS system) – read more here. The tracking capabilities combined with the rich segment building capabilites of Dynamics 365 for Marketing opens up for an useful automation scenario – building a dynamics segment of repeat web site visitors.

In this demo we’ll set up tracking on a web site and build a segment to capture repeat visitors.


  1. Copy the URL of the website your contacts visits to the clipboard
  2. Navigate to Marketing -> Websites and create a new website record
  3. Paste the URL for the clipboard into the URL field (1) and hit Save to generate the tracking script (2)
  4. Copy the tracking script to the clipboard
  5. Note the URL of the website record, especially the id to the right (3) – you’ll need that when setting up the segment
  6. Navigate to the admin interface of website your contacts visits (1)
  7. Open the Header (2) of the Website
  8. Paste the tracking script at the top of the Header (3)


  1. Navigate to Marketing -> Segments and create a new segment
  2. On the DESIGNER tab select Contact (1) and then Link between WebsiteVisited interaction and contact (2)
  3. Specify Conditions for Having count (1) and Sliding window (2), respectively how many visits and during what period. I’ll use greater than zero for the first just for demo purposes (if the segment was to be a true repeat visitors segment obviously I’d use greater the one for Having count)
  4. Select the WebsiteVisited field (1) and then the WebsiteId property (2)
  5. Paste the website record ID from the above SET UP TRACKING bullet #1 into the value field (1)  – see also: Find record IDs
  6. Save, Check for Errors and Go Live with the segment – the segment is empty for now


  1. Open another browser
  2. Log into eg Mail as a user matching a contact in your Marketing
  3. Open a new tab in the browser
  4. Visit the website from above
  5. Now navigate to Marketing -> Segments and verify new segment member is added as expected
  6. For what its worth – you can also navigate to the contact and verify that the website visits is tracked for the contact

So now you’ve seen how you can track website visits and build segments based on those. You can have a dynamic segment sitting there just waiting for contacts to visit you website and then take automated action via Customer Journeys.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s