Tuan Anh Hoang
Dec 12, 2025
  328
(2 votes)

CMS Audiences - check all usage

Sometimes you want to check if an Audience from your CMS (former Visitor Group) has been used by which page(and which version of that page)

Then you just need to use my sample SQL query to check the usage of that audience:

CREATE TABLE #TempGUID(ID INT IDENTITY(1,1),VGName VARCHAR(50), VGGuid VARCHAR(36));
 INSERT INTO #TempGUID (VGName,VGGuid) SELECT String01, Guid FROM tblSystemBigTable SBT join tblBigTableIdentity BTI ON SBT.pkId = BTI.pkId  where SBT.StoreName = 'VisitorGroup' ;

 DECLARE @CurrentValue VARCHAR(36);
 DECLARE @CurrentName VARCHAR(50);
 DECLARE @MinID INT = (SELECT MIN(ID) from #TempGUID);
 
 WHILE @MinID IS NOT NULL
 BEGIN
	SELECT @CurrentValue = VGGuid,@CurrentName = VGName FROM #TempGUID WHERE ID = @MinID

	SELECT DISTINCT @CurrentName AS AudienceName,fkContentID AS ContentID,NAME AS ContentName,pkID AS VersionNumber FROM tblWorkContent WHERE pkID IN 
		(SELECT fkWorkContentID FROM tblWorkContentProperty WHERE LongString like ('%'+ @CurrentValue+'%')) 

	DELETE FROM #TempGUID WHERE ID = @MinID;
	SET @MinID = (SELECT MIN(ID) from #TempGUID);
END;

DROP TABLE #TempGUID;

The reult should look like this:

Hope that help!

Dec 12, 2025

Comments

Please login to comment.
Latest blogs
Lessons from Building Production-Ready Opal Tools

AI tools are becoming a normal part of modern digital platforms. With  Optimizely Opal , teams can build tools that automate real tasks across the...

Praful Jangid | Mar 7, 2026

My Takeaway from Optimizely Opal Agents in Action 2026 - What Agentic AI Means for the Future of Digital Marketing

I would like to share with you what stayed in my head after this amazing virtual event organized by Optimizely. Agents in Action 2026 , a live...

Augusto Davalos | Mar 6, 2026

From Vision to Velocity: Introducing the Optimizely MVP Technical Roundtable

Digital transformation is a two-sided coin. On one side, you have the high-level strategy, the business cases, the customer journeys, and the...

Patrick Lam | Mar 6, 2026

Commerce 14.45.0 is incompatible with CMS 12.34.2 (but that's an easy fix!)

Incompatible is a strong word, but that is to get your attention. This is one of the small thing that can be overlooked, but if you run into it, it...

Quan Mai | Mar 5, 2026