integrating adobe experience manager 6

16
 ntegrating Adobe Experience Manager 6.1 Components with Adobe Analytics Applies to  Adobe CQ  Adobe Experience Manager Search Adobe Community Help  Contact support Article summary Summary Discusses how to create an AEM 6.1 component that is integrated with Adobe  Analytics. In addition, discusses how to configure AEM to connect to Adobe Analytics, setup the Adobe Analytics framework, and map component variables to Adobe Analytics variables. Digital Marketing Solution(s)  Adobe Experience Manager (Adobe CQ),  Adobe Analytics Audience  Developer (intermediate) Required Skills  JavaScript, HTML Tested On Adobe Experience Manager 6.1 Introduction  You can create Adobe Experience Manager (AEM) components that integrate with  Adobe Analytics. Adobe Analytics is the industry-leading solution that provides digital marketers with one place to measure, analyze, and optimize integrated data from all online initiatives across multiple mar keting channels. It provides marketers with actionable, real-time web analytics intelligence about digital strat egies and marketing initiatives. Adobe SiteCatalyst helps marketers quickly identify the most profitable paths through a website, segment traffic to spot high-value web visitors, determine where visitors are navigating away from the site, and identify critical success metrics for online marketing campaigns. By integrating AEM components with Adobe Analytics, you can gather information about user interaction with the AEM components, such as tracking how visitors are interacting with your components. For example, assume you developed an AEM component to track the number visitors using the component. When a user interacts with the component (for example, clicks a link), the component sends information to Adobe Analytics and a report is updated that you can view, such as shown in the following information.

Upload: abhinav-mishra

Post on 05-Nov-2015

21 views

Category:

Documents


1 download

DESCRIPTION

Integrating Adobe Experience Manager 6

TRANSCRIPT

  • ntegratingAdobeExperienceManager6.1ComponentswithAdobeAnalytics

    AppliestoAdobeCQAdobeExperienceManagerSearch

    AdobeCommunityHelp Contactsupport

    Articlesummary

    Summary

    DiscusseshowtocreateanAEM6.1componentthatisintegratedwithAdobeAnalytics.Inaddition,discusseshowtoconfigureAEMtoconnecttoAdobeAnalytics,setuptheAdobeAnalyticsframework,andmapcomponentvariablestoAdobeAnalyticsvariables.

    DigitalMarketingSolution(s)

    AdobeExperienceManager(AdobeCQ),AdobeAnalytics

    Audience Developer(intermediate)

    RequiredSkills JavaScript,HTML

    TestedOn AdobeExperienceManager6.1

    Introduction

    YoucancreateAdobeExperienceManager(AEM)componentsthatintegratewithAdobeAnalytics.AdobeAnalyticsistheindustryleadingsolutionthatprovidesdigitalmarketerswithoneplacetomeasure,analyze,andoptimizeintegrateddatafromallonlineinitiativesacrossmultiplemarketingchannels.Itprovidesmarketerswithactionable,realtimewebanalyticsintelligenceaboutdigitalstrategiesandmarketinginitiatives.AdobeSiteCatalysthelpsmarketersquicklyidentifythemostprofitablepathsthroughawebsite,segmenttraffictospothighvaluewebvisitors,determinewherevisitorsarenavigatingawayfromthesite,andidentifycriticalsuccessmetricsforonlinemarketingcampaigns.

    ByintegratingAEMcomponentswithAdobeAnalytics,youcangatherinformationaboutuserinteractionwiththeAEMcomponents,suchastrackinghowvisitorsareinteractingwithyourcomponents.Forexample,assumeyoudevelopedanAEMcomponenttotrackthenumbervisitorsusingthecomponent.Whenauserinteractswiththecomponent(forexample,clicksalink),thecomponentsendsinformationtoAdobeAnalyticsandareportisupdatedthatyoucanview,suchasshowninthefollowinginformation.

    Wasthishelpful?

    Yes No

  • AnAdobeAnalyticsreportdisplayingdatasentfromanAEMcomponent

    Asshowninthepreviousillustration,youcanviewcomponentinformation(componentsintegratedwithAdobeAnalytics)inanAdobeAnalyticsreport.ThisdevelopmentarticlewalksyouthoughallthestepstointegrateAEM6.1componentswithAdobeAnalytics,includinghowtosetAEMandAnalytics.

    TocreateanAEMcomponentthatisintegratedwithAdobeAnalytics,performthesetasks:

    1. CreateaCQapplicationfolderstructure.2. Createatemplateonwhichthepagecomponentisbased.3. Createthepagecomponentbasedonthetemplate.4. CreateanAEMcomponentthathooksintoAdobeAnalytics.5. CreateaCQwebpagethatusesthenewcomponent.

    Tothetop

    CreateaCQapplicationfolderstructure

    CreateanAdobeCQapplicationfolderstructurethatcontainstemplates,components,andpagesbyusingCRXDELite.

  • Note:

    ACQapplicationfolderstructure

    Thefollowingdescribeseachapplicationfolder:

    applicationname:containsalloftheresourcesthatanapplicationuses.Theresourcescanbetemplates,pages,components,andsoon.

    components:containscomponentsthatyourapplicationuses.

    page:containspagecomponents.ApagecomponentisascriptsuchasaJSPfile.global:containsglobalcomponentsthatyourapplicationuses.

    template:containstemplatesonwhichyoubasepagecomponents.

    src:containssourcecodethatcomprisesanOSGicomponent(thisdevelopmentarticledoesnotcreateanOSGibundleusingthisfolder).

    install:containsacompiledOSGibundlescontainer.

    Tocreateanapplicationfolderstructure:

    1. ToviewtheCQwelcomepage,entertheURLhttp://[hostname]:[port]intoawebbrowser.Forexample,http://localhost:4502.

    2. SelectCRXDELite.

    3. Rightclicktheappsfolder(ortheparentfolder),selectCreate,CreateFolder.

    4. EnterthefoldernameintotheCreateFolderdialogbox.Enteranalyticsexample.

    5. Repeatsteps14foreachfolderspecifiedinthepreviousillustration.

    6. ClicktheSaveAllbutton.

    YouhavetoclicktheSaveAllbuttonwhenworkinginCRXDELiteforthechangestobemade.

    Tothetop

    Createatemplate

    YoucancreateatemplatebyusingCRXDELite.ACQtemplateenablesyoutodefineaconsistentstyleforthepagesinyourapplication.Atemplatecomprisesofnodesthatspecifythepagestructure.Formoreinformationabouttemplates,seeTemplates.

    Tocreateatemplate,performthesetasks:

    1.ToviewtheCQwelcomepage,entertheURLhttp://[hostname]:[port]intoawebbrowser.Forexample,http://localhost:4502.2.SelectCRXDELite.3.Rightclickthetemplatefolder(withinyourapplication),selectCreate,CreateTemplate.4.EnterthefollowinginformationintotheCreateTemplatedialogbox:

    Label:Thenameofthetemplatetocreate.EntertemplateAnalytics.

    Title:Thetitlethatisassignedtothetemplate.

  • Description:Thedescriptionthatisassignedtothetemplate.

    ResourceType:Thecomponent'spaththatisassignedtothetemplateandcopiedtoimplementingpages.Enter/apps/analyticsexample/components/page/templateAnalytics.

    Ranking:Theorder(ascending)inwhichthistemplatewillappearinrelationtoothertemplates.Settingthisvalueto1ensuresthatthetemplateappearsfirstinthelist.

    5.AddapathtoAllowedPaths.Clickontheplussignandenterthefollowingvalue:/content(/.*)?.6.ClickNextforAllowedParents.7.SelectOKonAllowedChildren.

    Tothetop

    Createarendercomponentthatusesthetemplate

    Componentsarereusablemodulesthatimplementspecificapplicationlogictorenderthecontentofyourwebsite.Youcanthinkofacomponentasacollectionofscripts(forexample,JSPs,Javaservlets,andsoon)thatcompletelyrealizeaspecificfunction.Inordertorealizethisfunctionality,itisyourresponsibilityasaCQdevelopertocreatescriptsthatperformspecificfunctionality.Formoreinformationaboutcomponents,seeComponents.

    Bydefault,acomponenthasatleastonedefaultscript,identicaltothenameofthecomponent.Tocreatearendercomponent,performthesetasks:

    1.ToviewtheCQwelcomepage,entertheURLhttp://[hostname]:[port]intoawebbrowser.Forexample,http://localhost:4502.

    2.SelectCRXDELite.

    3.Rightclick/apps/analyticsexample/components/page,thenselectCreate,CreateComponent.

    4.EnterthefollowinginformationintotheCreateComponentdialogbox:

    Label:Thenameofthecomponenttocreate.EntertemplateAnalytics.

    Title:Thetitlethatisassignedtothecomponent.

    Description:Thedescriptionthatisassignedtothetemplate.

    SuperType:foundation/components/page.

    5.SelectNextforAdvancedComponentSettingsandAllowedParents.

    6.SelectOKonAllowedChildren.

    7.OpenthetemplateAnalytics.jsplocatedat:/apps/analyticsexample/components/page/templateAnalytics/templateAnalytics.jsp.

    8.EnterthefollowingJSPcode.

    12

  • Tothetop

    ConfiguringAEMtouseAdobeAnalytics

    AfteryousetuptheAEMfolderstructure(includingthetemplateandpagecomponent),configureAEMtoconnecttoAdobeAnalytics.ToconnecttoAdobeAnalytics,enteryourAdobeAnalyticsaccountinformation,includingyourusernameandpassword,asshowninthisillustration.

    TheAEMAnalyticsSettingsdialog

    Asyoucanseeinthepreviousillustration,youenterthecompany,username,andpasswordforyourAnalyticsaccount.YoucantesttheAdobeAnalyticsconnectionbyclickingtheConnecttoAnalyticsbutton.Itisstronglyrecommendedthatyoutesttheconnection.Ifitdoesnotwork,checkyouraccountcredentials.

    TosetuptheconnectionbetweenAEMandAdobeAnalytics,performthesetasks:

    1.FromtheAEMstartingpage(http://localhost:4502/projects.html),clickTools,Operations,Cloud,CloudServices.

    2345678

  • Note:

    2.IntheAdobeAnalyticssection,clickShowConfigurations.

    3.Clickthe[+]buttoninAvailableConfigurations.

    4.IntheCreateConfigurationdialog,enteratitleandname.BesuretoselectAdobeAnalyticsConfiguration.

    5.IntheEditConfigurationsdialog(showninthepreviousillustration),enteryourcompanyname,username,andpassword.

    6.Testtheconnection.

    7.Iftheconnectionissuccessful,clickOK.

    Tothetop

    CreatetheTopNavcomponentthatusesAdobeAnalytics

    CreateaTopNavcomponentthathooksintoAdobeAnalytics.Thatis,whenauserclicksonthelink,dataissenttoAdobeAnalytics.ThedatacanbeviewedwithinanAdobeAnalyticsreport(shownlaterinthisarticle).

    ThefollowingillustrationsshowstheTopNavcomponentthatisbuiltinthissection.

    AnAEMTopNavcomponentthatisintegratedwithAdobeAnalytics

    InthisarticletheTopNavcomponentiscopedfromlibsandmovedtoapps.Thenitismodified.

    ThefollowingillustrationshowstheTopNavcomponentinCRXDElite.

  • JCRnodesthatbelongtotheTopNavcomponent

    Inthepreviousillustration,noticetheanalyticsnode.ThisnodeisrequriedforyourAEMcomponenttohookintoAdobeAnalytics.Inaddition,youaddJScodetothecomponent'sJSP,asspecifiedinthefollowingprocedure.

    Performthesetasks:

    1.Rightclickthe/libs/foundation/components/topnavnodeandclickCopy.

    2.PastetheTopNavnodesto/apps/analyticsexample/components.

    3.Rightclickthe/apps/analyticsexample/components/topnavnode.SelectCreate>CreateNode.

    4.Specifythefollowingvalues:

    Name:analytics

    Type:nt:unstructured

    5.Addthefollowingpropertiestotheanalyticsnode:

    cq:trackvars(String)topnavTarget,topnavLocation

    cq:componentName(String)topnav(tracking)

    cq:componentGroup(String)General

    6.ClickSaveAll.

    7.Openthe/apps/analyticsexample/components/topnav/topnav.jspfile.

    8.Intheaelement,addthefollowingattribute:

    onclick="tracknav('.html')"

    9.Atthebottomofthepage,addthefollowingjavascriptcode:

    10.ClickSaveAll.

    Thefollowingcodeexamplerepresentstheentire/apps/analytics

    1234567891011121314

    functiontracknav(target){if(CQ_Analytics.Sitecatalyst){CQ_Analytics.record({event:'topnavClick',values:{topnavTarget:target,topnavLocation:'.html'},componentPath:''});}}

  • Thefollowingcodeexamplerepresentstheentire/apps/analyticsexample/components/topnav/topnav.jspfile.

    1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859

    functiontracknav(target){if(CQ_Analytics.Sitecatalyst){CQ_Analytics.record({event:'topnavClick',values:{topnavTarget:target,topnavLocation:'.html'},componentPath:''});}}

  • Tothetop

    IntegratingtheTopNavcomponentintotheAdobeAnalyticsFramework

    TocompletetheintegrationbetweenanAEMcomponentandAdobeAnalytics,youmapthecomponent'svariablestoAdobeAnalyticsvariablesusingtheAdobeAnalyticsframework.FirstensurethattheTopNavcomponent(thatisenabledforAdobeAnalyticstracking)isdisplayedintheAEMSidekicksothatyoucanaddittotheframework.

    ThefollowingillustrationshowstheTopNavcomponentdisplayedinthesidekick.

    TheTopNavcomponentthatisdisplayedinthesidekick

    SetupanewAdobeAnalyticsFrameworkview

    SetupanAdobeAnalyticsFrameworkbyperformingthesetasks:

    1. OpentheSiteCatlystadministrationconsole.(http://localhost:4502/etc/cloudservices/sitecatalyst.html)

    2. Selecttheconfigurationthatyousetupalready.

    3. Clickthe[+]link.ThisbringsuptheCreateFrameworkdialog.

    4. SelectAdobeAnalyticsFramework.

    5. SpecifyaTitleandName.

    6. ClickOK.

    7. ThisbringsuptheAdobeAnalyticsFramework.

    SetupReportvaluesintheAdobeAnalyticsFrameworkview

    5960

    }

  • Note:

    SetuptheAnalyticsReportvaluesinthenewlycreatedFrameworkview.Inthisview,youmaptheTopNavcomponent'svariablestoAdobeAnalyticvariables.ThefirsttaskyouperformisdragtheTopNavcomponentfromtheAEMsidekicktotheframework,asshownhere.

    AdobeAnalyticsFrameworkview

    Ifthesidekickisempty,onSidekick,clicktheDesignbutton.IntheLinkTrackingConfigurationarea,clickConfigureInheritance.IntheAllowedComponentslist,selecttopnav(tracking)intheGeneralsection,thenclickOK.ExpandSidekicktoentereditmode.ThecomponentisnowavailableintheGeneralgroup.

    ThiscausestheAEMvariablesassociatedwiththecomponenttobedisplayed,asshowninthefollowingillustration.

    TopNavcomponentvariables

    NoticethattherearethreevariablesassociatedwiththeTopNavcomponent.

    eventdata.topnav.Target

  • eventdata.topnavLocation

    eventdata.events.topnavClick

    Theeventdata.events.topnavClickvariablerepresentstheeventthatoccurswhentheuserclickstheTopNavlink.Maptheeventdata.events.topnavClickvariableanAdobeAnalyticsvariablethatislocatedintheleftpanel.

    SetupReportSuitedetails

    Next,setuptheReportSuitedetails.IntheReportSuitesdropdown,youhaveaccesstoReportSuitesthatareavailableforyourAdobeAnalyticsaccount.Selectareportfromthedropdownlist.Also,specifywhethertheTopNavcomponentistrackedonauthor,publish,orboth.

    ThefollowingillustrationshowsaconfiguredReportSuite.

    ReportSuitedetails

    Inthisexample,thereportsuiteisjjesquire137andthecomponentisconfiguredtobetrackedonbothauthorandpublish(all).

    MapAdobeAnalyticsvariablestocomponentvariables

    OnceyousetuptheReportSuitedetails,youhaveaccesstoAnalyticsvariablesthatyoucanmaptocomponentvariables.MappingtheTopNavcomponentvariablestoAdobeAnalyticvariablesishowyousenddataaboutacomponenttoanAdobeAnalyticsreport.

    TheAdobeAnalyticvariablesareshownintheleftpane,asshowninthisillustration.

  • Note:

    AdobeAnalyticsvariables

    Onthevariablespane,youcandisplaydifferenttypeofvariables.Forexample,youcandisplayeventvariables(underwhichthePageViewvariableislisted)byclickingtheEventbuttonatthetopofthepanel.

    MapAdobeAnalyticvariablestotheTopNavcomponentvariablesbydraggingtheAdobeAnalyticsvariablefromtheleftpanetotheTopNavcomponent,asshownhere:

    OnceyoudragtheAdobeAnalyticsvariableandmapittotheTopNavcomponentvariable,youwillseethefollowingmappinginformation:

  • Note:

    Note:

    componentvariable,youwillseethefollowingmappinginformation:

    TopNavcomponents

    Asyoucansee,theeventdata.events.topnavClickcomponentvariableismappedtotheAdobeAnalyticsPageViewsvariable.NowwhenauserclicksalinkintheTopNavcomponent,dataissenttoAdobeAnalyticsandthePageViewsvariableisincremeted.

    TheAdobeAnalyticsvariablesthatappeardependuponthevaraiblesthatareconfiguredforyourAdobeAnalyticsaccount.

    FormoreinformationabouttheAdobeAnalyticsFramework,seehttps://docs.adobe.com/docs/en/aem/61/administer/integration/marketingcloud/sitecatalyst/scconnect.html.

    Activatetheframework

    OnceyouaredonemodifyingtheAdobeAnalyticsframework,youhavetoactivateitinorderforittotakeeffect.Toactivateit,clicktheActivateFrameworkbuttononthesidekick(underthepagetab),asshowninthefollowingillustration.

  • ActivateFrameworkoperationonthesidekick

    Tothetop

    ModifytemplateAnalytics.jsp

    ModifythetemplateAnalytics.jspthatislocatedat:

    /apps/analytics

    example/components/page/templateAnalytics/templateAnalytics.jsp

    AddthefollowinglineofcodetoincludetheTopNavcomponent:

    ThefollowingcoderepresentsthemodifiedtemplateAnalytics.jspfile.

    Tothetop

    CreateanAEMsitethatisbasedonthetemplateAnalyticspagecomponent

    CreateanAEMsite(basedonthetemplateAnalyticspagecomponent)thatcontainsapageandachildpage.TheTopNavcomponentreadsthechildpageandprovidesalinktoaccessthechildpage.Whenauserclicksthelinktothechildpage,dataissenttoAdobeAnalytics.

    ThefollowingillustrationshowstheAEMpagestructure.

    123456789

  • Thewebsitestructure

    Performthesetasks:

    1. GototheCQWebsitespageathttp://localhost:4502/siteadmin#/content.

    2. SelectNewPage.

    3. SpecifythetitleofthepageintheTitlefield.EnterAnalytics.

    4. SpecifythenameofthepageintheNamefield.

    5. SelecttemplateAnalyticsfromthetemplatelistthatappears.Thisvaluerepresentsthetemplatethatiscreatedinthisdevelopmentarticle.Ifyoudonotseeit,thenrepeatthestepsinthisdevelopmentarticle.Forexample,ifyoumadeatypingmistakewhenenteringinpathinformation,thetemplatewillnotshowupintheNewPagedialogbox.

    6. CreateachildpagenamedHello.

    7. OpenthepagebyclickingtheAnalyticspage.ClicktheHelloLink.ThisfiresofftheeventthatismappedtotheAdobeAnalyticsvariable.

    ViewtheReportinAdobeAnalytics

    YoucanviewanAdobeAnalyticsreportthatshowsthedatathatistracked.Inthisexample,viewareportthatdisplaysthevalueofthePageViewvariablethatismappedtotheTopNavcomponent'seventdata.events.topnavClickvariable.

    ThefollowingillustrationshowstheAdobeAnalyticsreportdisplayingthePageViewvalues.

  • AnAdobeAnalyticsReportdisplayingpageviews

    Seealso

    Congratulations,youhavejustcreatedanAEM6.1componentthatisintegratedwithAdobeAnalytics.PleaserefertotheAEMcommunitypageforotherarticlesthatdiscusshowtobuildAEMservices/applications.