Breadcrumbs

Count frequency of a keyword in social media content

📚

Count the occurrences of a special (marketing) keyword in a text field.

In this use case both the content and the keyword for a social media post are stored in separate fields.

Configuration

Create a Custom smart number field and use the General parsing mode.

Expression

%{count(findPattern(%{issue.cfnnnnn}, %{issue.cfmmmmm}))}

Please, note that it is necessary to replace nnnnn with the ID of the custom field containing the content and mmmmm with the ID of the custom field containing the keyword.

image-20250916-111112.png

Used parser functions

The links lead to the JWTC documentation because the parser functions are shared functionalities.

Details

1. What does the expression do?

The expression counts how many times a specific keyword appears in the content of a social media post. Both the content and the keyword are stored in separate custom fields in your work item.

2. Step-by-step breakdown

Let’s break it down:

  • %{issue.cfnnnn}: This refers to the custom field that contains the text/content of the social media post. You need to replace nnnnn with the actual ID of your content field.

  • %{issue.cfmmmm}: This refers to the custom field that contains the keyword you want to search for. Replace mmmmm with the actual ID of your keyword field.

  • findPattern(text, pattern): This parser function searches the given text (the content field) for all occurrences of the pattern (the keyword field) and returns a list of matches.

  • count(list): This function counts the number of items in the list returned by findPattern, which is the number of times the keyword appears in the content.

3. Examples

Suppose:

  • The content field (ID: 12345) contains: "Our new product is amazing! Try our product today. Product launch is tomorrow."

  • The keyword field (ID: 67890) contains: "product"

The expression would look like:

%{count(findPattern(%{issue.cf12345}, %{issue.cf67890}))}

This would count how many times "product" appears in the content, which is 3.

4. Real-life use cases

  • Marketing teams can track how often a campaign keyword is mentioned in user-generated content.

  • Social media managers can measure the frequency of brand mentions in posts.

  • Analysts can monitor the use of specific hashtags or terms in feedback or comments.