Hi All,
I have created Search Servlet and as per the requirement I need to track search data like search count ,search result.
so for that I have created Sling Model for Analytics Tracking of current page data and For that Sling Model I need search data as well.
does anyone worked on same type of requirement.
Solved! Go to Solution.
Views
Replies
Total Likes
If you are running server-side code to push this information over to Analytics or some other back end system, then I would agree with Brian's post here. Sling models are generally for representing a JCR resource that correlates with a page component. An OSGi service is going to provide you access to all of the same contexts that would be applicable to your task, and would be easier to leverage from your search servlet.
However, if you're looking for Analytics to pick this data up from the front end web page (similar to other Analytics data), it would be great to simply push this context into the Analytics datalayer. Rather than using a servlet for search results, you can create a Sling Model for your "search_results" component - that sling model could A) execute the search and then B) update the datalayer with the data to by picked up by Analytics.
As a best practice to enforce re-usability, Maybe you can extract the business logic from the servlet into an OSGI service, so that all of your OSGI components can be using the same service.
If you are running server-side code to push this information over to Analytics or some other back end system, then I would agree with Brian's post here. Sling models are generally for representing a JCR resource that correlates with a page component. An OSGi service is going to provide you access to all of the same contexts that would be applicable to your task, and would be easier to leverage from your search servlet.
However, if you're looking for Analytics to pick this data up from the front end web page (similar to other Analytics data), it would be great to simply push this context into the Analytics datalayer. Rather than using a servlet for search results, you can create a Sling Model for your "search_results" component - that sling model could A) execute the search and then B) update the datalayer with the data to by picked up by Analytics.
Views
Likes
Replies
Views
Likes
Replies