Tag: xConnect

  • Video series “Diving into Sitecore Analytics” launched

    Video series “Diving into Sitecore Analytics” launched

    I have launched a video series on youtube. The goal is to touch on as many Sitecore Analytics and Experience Platform features as possible without going into too much detail. We’ll start out with out of the box features…but coders don’t worry: there will be code in the later episodes! 🙂

    Any kind of feedback is always welcome.

    Episode 1: Getting Engaged

    In the first episode, we’ll learn how to measure user engagement through goals and page events:

  • Handling Analytics Processing Issues

    Recently, authors were reporting that no more Analytics data was being displayed since a certain date.

    analytics-missingWhen analyzing the logfiles of the processing/reporting server, there were many of these entries:

    Exception: Sitecore.Xdb.Processing.Queue.ProcessingPoolException Message: Execution Timeout Expired. The timeout period elapsed prior to completion of the operation or the server is not responding.

    The reason for this was that the Processing.Pools.InteractionLiveProcessingPool table had ~120’000 entries in it and was constantly growing. The attempts count on the top records was very high:

    full-processing-pool

    The processing server was running into a timeout when accessing this large amount of entries. Copying the entries into a temporary table and remove all entries from the InteractionLiveProcessingPool table helped fix this temporarily.

    INSERT INTO tmp_ InteractionLiveProcessingPool SELECT * from InteractionLiveProcessingPool
    

    Processing immediately started working again as new interactions were processed and processed entries were removed from the table every few seconds.
    I then tried to copy blocks of the tmp_ InteractionLiveProcessingPool table back:

    INSERT INTO [xdb_processing_pools].[InteractionLiveProcessingPool]
    SELECT TOP 1000 * FROM dbo.tmp_InteractionLiveProcessingPool ORDER BY Created DESC</code>
    
    SELECT count(*) FROM [xdb_processing_pools].[InteractionLiveProcessingPool]
    
    DELETE FROM dbo.tmp_InteractionLiveProcessingPool
    WHERE [tmp_InteractionLiveProcessingPool].InteractionId IN
    (SELECT TOP 1000 InteractionId FROM dbo.tmp_InteractionLiveProcessingPool ORDER BY Created DESC)
    

    But processing was very slow. It could hardly keep up with the live interactions that were being generated from site traffic.
    To optimize this, I had to increase processing power by

    • Increasing the batch size
    • Increasing aggregation worker threads
    
    <aggregation role:require="Standalone or Processing">
          <aggregator>
            <!-- Increase processing batch size from 64 to 256 -->
            <param type="Sitecore.Analytics.Core.ConfigurationHelper, Sitecore.Analytics.Core" desc="maximumBatchSize" factoryMethod="ToShort" arg0="256"/>
          </aggregator>
    
          <module type="Sitecore.Analytics.Aggregation.AggregationModule" singleInstance="true">
            <BackgroundServices hint="list:Add">
              <aggregator type="Sitecore.Analytics.Core.AsyncBackgroundService">
                <!-- Increase aggregation worker threads to 4 -->
                <param desc="maxAgents" type="Sitecore.Analytics.Core.ConfigurationHelper, Sitecore.Analytics.Core" factoryMethod="ToInt" arg0="4" />
              </aggregator>
            </BackgroundServices>
          </module>
    </aggregation>
    
    
    

    Watch your Processing Server performance after these changes!

    If you’d have the same issue during a Reporting DB rebuild (InteractionHistoryProcessingPool) table, you would need to tweak the historyWorker background service instead. For details, see https://doc.sitecore.com/developers/91/sitecore-experience-platform/en/configure-processing-agents.html

    Caveat: The documentation states:

    «Adjust the MaxPoolSize property for the reporting database. The pool capacity should be at least about 120% of the number of agents (including processing, history, automation workers, and clean-up) that you have configured»

    Not having the maxPoolSize set explicitly on the connection string means that the default value of 100 will be used. My total number of workers was still nowhere near this value hence the maxPoolSize didn’t need to be adjusted.
    After these changes, processing was noticeably faster. I copied back all the entries from the temporary table and processing took roughly 6 hours to handle the remaining ~100’000 interactions.

    INSERT INTO [xdb_processing_pools].[InteractionLiveProcessingPool]
    SELECT * FROM dbo.tmp_InteractionLiveProcessingPool ORDER BY Created DESC
    
    SELECT count(*) FROM [xdb_processing_pools].[InteractionLiveProcessingPool]
    
    DELETE FROM dbo.tmp_InteractionLiveProcessingPool
    

    And voilĂ , the reports were back:

    screenshot-result

  • Debugging xConnect with xConnectHelper

    Debugging xConnect with xConnectHelper

    Setting up and testing xConnect can be a challenge – especially in on premise setups. Are all the certificates set up? Are all databases up and connection strings correct?

    Initiially, tracking, processing and reporting can be somewhat of a black box because to see it working correctly i.E. to test experience profile functionality, you’ll have to first write code to identify a contact through a form submit, start a session with interactions, trigger identification and wait for your session to expire and wait for processing / reporting in order for your contact to show up in the expirence profile manager.

    To aid with this, I have ported my trusted little xDB Helper over to Sitecore 9+ / xConnect. Because of the many API and conceptual changes, this was a re-write from scratch. The source code is available on Github.

    How does the helper help?

    After installing, you can access the page through

    /sitecore%20modules/Web/xConnectHelper/xConnectHelper.aspx?key=<yourkey>
    

    On this page you can…

    • View status information on the current Tracker config and collection service connection
    • View basic contact facets
    • Set one or multiple identifiers for the current contact
    • Set basic contact facets
    • Flush current session which immediately triggers processing

    xconnect-helper-2

    Some possible use cases:

    I want to check the xConnect connection:
    If there is a connection problem, this will be immediately shown on the xConnectHelper page. Also, if the tracker is not active becaues of config or license issues.

    xconnect-helper-1

    I want to check if data is written to the collection and reporting db:
    Interact with your website and then hit flush current session. Processing of your contact and interactions will immediately start and data should be visible in the databases within seconds.

    I want to test contact search / experience profile:
    The experience profile manager only lists identified contacts. You can set an identifier for your contact, then flush session. Your contact should show in the list within a few seconds.

    How to install

    1. Clone Repo
    2. Build and publish to your site.
    3. Set a hard-to guess key in App_Config/Modules/xConnectHelper/xConnectHelper.config
    4. Access your page through /sitecore%20modules/Web/xConnectHelper/xConnectHelper.aspx?key=yourkey

    Important Note: Because this tool is made to debug current contacts and interactions in-session, it can not be used as a regular Sitecore admin page and is therefore publicly accessible (ony restricted by your access key). You are responsible for setting appropriate measures to regulate access to this page.