Showing posts with label Cloud Services. Show all posts
Showing posts with label Cloud Services. Show all posts

Saturday, 4 November 2017

Get properties in AEM sling servlet

Usecase: I had a situation to fetch properties from node/page/cloud configurations from sling servlet. 

Issue: In wcmusepojo we can get these cloud configuarations using getInheritedPageProperties(). But inheritedPageProperties variable is not accessible in osgi service or sling servlet.

To get properties of a node/page/cloud configurations from sling servlet do the following.
Below is sample servlet code.
* Author: Kishore Polsani
@Component(name = "com.kishore.aem.GetProperties", label = "Get Properties", immediate = true, metatype = true)
@Properties({ @Property(name = "service.description", value = "Get Properties"),
            @Property(name = "sling.servlet.paths", value = "/services/aemquickstart/getproperties", propertyPrivate = true),
            @Property(name = "service.vendor", value = "AEMQuickstart")
    public class GetProperties extends SlingAllMethodsServlet implements Serializable {
        private static final long serialVersionUID = 1L;
        private Logger log = LoggerFactory.getLogger(GetProperties.class);
        protected SlingRepository repository;
        private ResourceResolverFactory resolverFactory;
        protected void doGet(SlingHttpServletRequest request, SlingHttpServletResponse response) throws ServletException
            try {
                Map<String, Object> param = new HashMap<String, Object>();  
                param.put(ResourceResolverFactory.SUBSERVICE, "readService");
                ResourceResolver resourceResolver=null;
                resourceResolver = resolverFactory.getServiceResourceResolver(param);
                /* Get this path from ajax call request*/
                Resource pageResource = resourceResolver.getResource("/etc/cloudservices/salesforce/kishore/jcr:content");
                Node configNode = pageResource.adaptTo(Node.class);
      "Access token from cloud config"+configNode.getProperty("accesstoken"));
                Session session = resourceResolver.adaptTo(Session.class);
            } catch (AccessDeniedException e) {
            } catch (PathNotFoundException e) {
            } catch (ItemExistsException e) {
            } catch (ReferentialIntegrityException e) {
            } catch (ConstraintViolationException e) {
            } catch (InvalidItemStateException e) {
            } catch (VersionException e) {
            } catch (LockException e) {
            } catch (NoSuchNodeTypeException e) {
            } catch (LoginException e) {
            } catch (RepositoryException e) {

Check this post to get properties in different way: Registering a Servlet for every Page in AEM

Friday, 17 February 2017

AEM DTM Integration

The purpose of this blog is to go over AEM DTM Integration process step by step, using the recommended configuration options. There is documentation available for integration by Adobe here. Although, for someone who is integrating AEM DTM for the first time or with limited knowledge of one or the other, it is quite overwhelming to be exposed to the technicalities of all the available options at once. This post will also elaborate and expand on embedding DTM code on various experiences built within a single AEM instance. I hope this blog helps in simplifying the process for you.
Assuming you have an author instance of AEM running, there are the three majors steps you need to perform to add the DTM code on your site via the cloud-hosted services integration:
  1. Create web property in DTM
  2. Configure AEM DTM Integration
  3. Embed DTM code in a specific AEM site

Saturday, 14 May 2016

Integrating AEM with Adobe Analytics and Target using DTM

You can create Adobe Experience Manager (AEM) solutions that integrate with these Ditigal Marketing products: Adobe Analytics, Adobe Target, and Dynamic Tag Manager (DTM).
Adobe Analytics is the industry-leading solution that lets digital marketers analyze and optimize integrated data from all online initiatives across multiple marketing channels. It provides marketers with actionable, real-time web analytics intelligence about digital strategies and marketing initiatives.
Adobe Target is a personalization solution that lets you easily identify content through tests that are easy to execute. Therefore, you can deliver the best experience to your web visitors. In this article, personalization of the landing page is driven by Target. AEM will import Audiences from Target so that they can be used right within AEM to create activities to personalize our page. AEM then synchronizes the activity to Target.
DTM is a Digital Marketing cloud service that allows a marketer to manage Adobe and third-party tags used for tracking or other analytic purposes. It is done through client-side scripting that injects tag related code throughout the pages of the site.
By using these products together, you can build engaging solutions that let you deliver the best content to a given web site visitor. That is, you display content from AEM DAM that meets the interest of the visitor. This development article walks you through how to build a solution that uses AEM, Analytics, Target, and DTM. 
The following illustration provides an overview some of the Marketing Cloud solutions (AEM, DTM, Analytics, and Target) used in this article.

Overview of the Digital Marketing Solutions