Expand my Community achievements bar.

SOLVED

AEM 6.0 Tagging Count Usage

Avatar

Level 5

I created a new component called "tagTest.jsp" and its dialog is as follows:

<?xml version="1.0" encoding="UTF-8"?> <jcr:root xmlns:cq="http://www.day.com/jcr/cq/1.0" xmlns:jcr="http://www.jcp.org/jcr/1.0" jcr:primaryType="cq:Dialog" xtype="dialog"> <items jcr:primaryType="cq:Widget" xtype="tabpanel"> <items jcr:primaryType="cq:WidgetCollection"> <default jcr:primaryType="cq:Widget" title="Basic" xtype="panel"> <items jcr:primaryType="cq:WidgetCollection"> <tags jcr:primaryType="cq:Widget" allowBlank="false" cls="cq-propsdialog-tags" fieldLabel="Tags" name="./cq:tags" xtype="tags" /> </items> </default> </items> </items> </jcr:root>

A simple CQ.tagging.TagInputField, which stores a String[] of authored tags in the default "cq:tags" property. Slap the component on a page and author a tag on it, then when I head on over to http://localhost:4502/tagging and click the "Count usage" button, I don't get a single number in the "Count" column. I did a search through the forum first and saw this question which was "answered" but not very thoroughly: http://help-forums.adobe.com/content/adobeforums/en/experience-manager-forum/adobe-experience-manage...

Do I need to register my component to be included in this count? Is that even possible? How do I utilize the OOTB Tagging panel's Count usage in custom component implementations?

Thanks for any and all help!

1 Accepted Solution

Avatar

Correct answer by
Level 5

For reference to anyone else who may find this thread. The Tag Administration site's (http://localhost:4502/tagging) Count usage button appears to only count tags that are used in the "Tags/Keywords" dialog of a page's properties.

Per Adobe's recommendation, if you need to count the usage of tags used in a custom component's TagInputField ("tags" xtype), the best way would be to create a Sling Servlet or a service to fetch that information using the TagManager API. Scott (smacdonald2008) put together a great Helpx article on how to do just that:

https://helpx.adobe.com/experience-manager/using/tagmanager-api-search-tags.html

View solution in original post

3 Replies

Avatar

Level 10

The reason why Lokesh answered that thread in this manner is because there is no community article that shows this use case (or covered in docs). Therefore, a more general response was given as opposed to referencing a working example in a community article. 

This use case looks like an important one to capture in an AEM community article. I can help you - but i need to see your code. Did you use a backed service that uses an AEM API to get this count? 

Send me your code (both front end and backend - Java if you have it) and I will look into this.

I cannot figure out your logic by looking at the structure of the dialog. Place your ZIP (of the /App that uses the component) into a Dropbox URL and send me that URL at scottm@adobe.com. We will get this addressed. 

Avatar

Level 5

Hi Scott,

This was strictly an example I setup to test why the count usage wasn't working in any of our project's custom components that utilize the out-of-the-box tags xtype. I can try to package up the component but the Java logic is in our project bundle. Do you want me to extract the java and place it in a scriptlet in the component's JSP before sending or should I just paste everything in code snippets here? It's all pretty straightforward/simple stuff.

Thanks for the speedy reply!

- Greg

Avatar

Correct answer by
Level 5

For reference to anyone else who may find this thread. The Tag Administration site's (http://localhost:4502/tagging) Count usage button appears to only count tags that are used in the "Tags/Keywords" dialog of a page's properties.

Per Adobe's recommendation, if you need to count the usage of tags used in a custom component's TagInputField ("tags" xtype), the best way would be to create a Sling Servlet or a service to fetch that information using the TagManager API. Scott (smacdonald2008) put together a great Helpx article on how to do just that:

https://helpx.adobe.com/experience-manager/using/tagmanager-api-search-tags.html