Tuan Anh Hoang
Dec 12, 2025
  410
(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
Is the most powerful AI model really the best value?

Artificial Intelligence is already becoming part of everyday software development. Developers now use AI tools to generate code, write documentatio...

K Khan | May 16, 2026

Optimizely London Dev Meetup 2026

Well, everyone, it's that time of the year again, and we have another London Developer meet up coming for this summer. The date is set for the 2nd ...

Scott Reed | May 15, 2026

Building a Custom RAG for Optimizely Opal

How to design a standalone RAG service for documents that don't belong in Optimizely One, and expose it to Opal and other AI tools without coupling...

Michał Mitas | May 14, 2026 |

Building a Custom RAG for Optimizely Opal

Opal's built-in knowledge is limited to content inside Optimizely One. Here's how to design a custom RAG service for documents that live outside th...

Michał Mitas | May 14, 2026 |