Personalization does not work properly on the first visitor request

While using personalization or conditional renderings with rules based on the geographical information of the visitor (such as where the country is equal to specific country), the personalized content might not been presented to the visitor correctly on the first request.

Sitecore is designed not to wait until the GeoIP information has been resolved from a GeoIP lookup provider. This is implemented to keep response times for the website visitors low in situations when the GeoIP resolution process is taking a long time.

To make Sitecore wait for the GeoIP information even on the first request from a visitor, proceed as follows:

Step 1: Create a custom processor for the createVisits pipeline:

namespace Sitecore.Module.Foundation.Personalization.Pipelines.Processor
    {
         using Sitecore.Analytics.Pipelines.CreateVisits;
         using Sitecore.Configuration;
         using Sitecore.Diagnostics;
         using System;
    
          public class UpdateGeoIpData : CreateVisitProcessor
           {
             public override void Process(CreateVisitArgs args)
              {
                Assert.ArgumentNotNull(args, "args");
                Assert.ArgumentNotNull(args, "args");
                int intSetting = Settings.GetIntSetting("Analytics.PerformLookup.CreateVisitInterval", 5); // retrieve the delay value from the setting.
                args.Interaction.UpdateGeoIpData(TimeSpan.FromSeconds((double) intSetting)); // wait for the time specified in the Analytics.PerformLookup.CreateVisitInterval setting.
               }
            }
     } 

Step 2: Create a Patch file to override the existing processor i.e. ‘Sitecore.Analytics.Pipelines.CreateVisits.UpdateGeoIpData

<configuration xmlns:patch=http://www.sitecore.net/xmlconfig/ xmlns:set=http://www.sitecore.net/xmlconfig/set/ xmlns:role=http://www.sitecore.net/xmlconfig/role/>
  <sitecore role:require="Standalone or ContentDelivery or ContentManagement">
    <pipelines>
      <createVisit>
        <processor patch:instead="processor[@type='Sitecore.Analytics.Pipelines.CreateVisits.UpdateGeoIpData']" type="Sitecore.Module.Foundation.Personalization.Processor.UpdateGeoIpData, Sitecore.Module.Foundation.Personalization" />
      </createVisit>
    </pipelines>
  </sitecore>
</configuration>

The approach overrides the logic of the createVisit pipeline and makes Sitecore wait a certain period of time for the GeoIp information to be resolved. The delay time is configured using the Analytics.PerformLookup.CreateVisitInterval setting. The setting defines the maximum delay to resolve the geographical data from the lookup provider allowed during the first page-request of a new visit.

Sitecore Personalization Based on Source Page – Custom Personalization Rule

Sitecore Personalization is one of the great feature that we have OOTB in Sitecore. Personalization enables you to deliver targeted, relevant content to your site visitors. Personalization is the method for displaying targeted, relevant content to your contacts based on their characteristics and behavior, such as location, gender, or previous visits.

There are a number of rules and parameters that are currently available in the Rule Set Editor for Sitecore Device Detection. We can use these to further customize your Sitecore sites and optimize the presentation of your website on different devices for your visitors.

In this post, I would like to show how we can extend and build custom personalization rules based on Source/Previous page, we will take an example of creating a custom rule where based on source/previous page item value how we can display different content to our site visitors.

Step 1:

In our case as we are creating custom rule, so will be planning to use existing custom tag which is available on below path.
==> /sitecore/system/Settings/Rules/Definitions/Tags/Custom
Either we can create a new tag for our Custom rule under
==> /sitecore/system/Settings/Rules/Definitions/Tags/Custom Rules
based on template ==> /sitecore/templates/System/Rules/Taxonomy/Tag

Custom Rule

Step 2:

After creating Custom Rule Tag, will have to create Custom Rule Element using Taxonomy Element using below template /sitecore/system/Settings/Rules/Taxonomy/Element Folder” and inside the Custom Rule we can create Custom Rule considtion i.e. “Source Page” in our case using below template
/sitecore/system/Settings/Rules/Condition

Custom Rule Element

In Content section of newly created “Source Page” custom rule, we can get two important fields i.e. “Text” inside the Data section and “Type” inside the Script section.

Text – We have to update the text that would be presented to content editors when using this condition with Rules Engine. Square brackets [] will be replacing by Rules Enging as selectors.
Type – Type will use fully qualified class and assembly names of the custom personalization condition

Once will update the personalization rule on Text and fully qualified class and assembly names on Type. We have to add the “Custom Rule” tag which we have created in Step 1 on Tags on the same level on Tags Element of Custom Rule.

Step 3:

As we have created the personalize rule and need to add this tag on conditional rendering so that this newly added personalized rule will be available on rule editor for content editors to personalize the components.

Once above mentioned changes are completed, content author will able to configure this rule to personalize the components from experience editor or content editor from presentation->Personalize section.

Sitecore 10 Certification Questions

  1. A Content Author cannot add components to a page location you’ve identified as the main placeholder. What is the possible solution for this issue?
    You enable placeholders in Sitecore.config
    You create a Placeholder Settings item
    You dynamically bind the Placeholder to the Layout
    You add a placeholder to Allowed Placeholders folder
  1. When performing multisite implementation where should shared content be stored
    Shared content should be stored out any one site’s content tree structure
  1. When you are working with a multisite implementation, what is the recommended practice for creating each site’s tree structure.
    Create a specific site definition configuration, a folder for each site under the Content item, and a Home item for each site within the folder

4. Why is the user getting the error in this picture

Non-existent Solr path

  1. From what interfaces can you access the Publishing Wizard? (2 correct)
    Experience editor and content editor (and also Sitecore Desktop but there was not a choice)

  1. How would you publish after an item is changed in the code?
    code publish – manually copy cshtml files from solution to web root folder
    (not publish from sitecore because that just moves master->web)
  1. In what file would you map the home item to a corresponding host name
    Patch config file
  1. What is a template
    A Data Structure
  1. What does the Allowed CORS Origin do
    Tells ID server to authenticate requests from two files with different names
  1. How can administrator unlock someone who forgets their password
    UserManager -> unlock
    User Manager -> Select User -> Click Unlock
  1. What is the Extranet domain
    contains user accounts that correspond to visitors
    contains customized roles that gives visitors read access
  1. What rules apply to conflicting roles
    Access rights – Denied overrides Allowed.
    Security accounts – Access rights assigned to a user account override access rights assigned to a role.
    Item – Access rights assigned specifically on an item override access rights specified for the descendants on the parent item.
  1. Why is it recommended to assign rights to roles and not users
    It is safer and more efficient
  1. What is Sitecore Support Package used for
    It helps the Sitecore team replicate an issue without accessing the actual Sitecore environment
  1. Which two of the following statements are reasons for assigning security rights to roles instead of individual users
    Roles enable you to control security access for groups of users and roles simultaneously
    Assigning permissions to individual users can be confusing and create risk
  1. What are the Workflow elements
    states, commands, actions
  1. What is the purpose of Field Sections
    To group similar fields
  1. What is a standard value
    A default value for a field that is a fallback value when the field is NULL
  1. Should you edit on the Web Database
    No, If you edit on Web DB content changes will be overwritten on the next publish
  1. Diagram – which fields are candidates for template inheritance
    If the same field is in all three templates, it can be moved to the base template
  1. When is template inheritance not recommended for fields with the same name
    When the fields require different field sources
  1. For which fields do you have to set a source field
    multilist, droptree, treelist
  1. What is the difference between a droplist and a multilist
    Droplist – users select one item,
    Multilist – users select 0 or more
  1. What is a token
    Initial values that get replaced when an item is created ($name, $date, etc.)
  1. Why would you add a tag to an item
    To categorize items and make them easier to search for
  1. If two text fields with same name, but one has a bigger font, are they good candidates for inheritance
    Yes, because even though the fonts are different they still have the same source
  1. Where should you set up presentation details
    In standard values to standardize the creation process and keep content editors from adding their own presentation details
  1. What is required to create a layout
    A Layout definition item defined in Sitecore mapped to a layout .cshtml file
  1. What happens if you remove any of the layout details
    The rendering will not be visible because in order for a Layout to be visible it requires a Layout and Controls
  1. What is a dynamic placeholder
    same key – unique content
    can add the same placeholder name several times across one or multiple renderings
  1. What tag is used to order files in .config files
    <loadorder>
  1. What kind of layout would you use if you want to publish a temporary anniversary page
    Versioned layout
  1. How is a placeholder defined
    A placeholder is uniquely defined by a placeholder key
  1. Which of the following cannot be rendered using HTML.Sitecore.Field()
    Checkbox
  1. When adding a new component that shares the same data source as another, what is an alternative to creating it from scratch
    Using Compatible Renderings
  1. Why would you use static component binding
    Static binding means adding a rendering to a page in a raw way. Or
    When you want to stop content editors from removing a component
  1. Why would you specify a the Datasource location for a rendering
    To restrict content editors so they must select content from a specific part of the content tree
  1. What is the difference between Datasource location and Datasource template
    Datasource location filters by location in the content tree, but Datasource template filters based on a template
  1. When would you add insert options on an item in the content tree instead of the standard values for that item’s template
    When you want to add additional options from what is in the standard values
  1. Describe ASP.NET Core headless architecture
  • independent, render Sitecore content
  • De-coupled
  • light-weight
  • consumes Sitecore Layout Service
  • Preview code changes
  1. What is a Custom View
    reusable, complex logic, used for nav menus, login panels, search bar
  1. What is Startup.css file
    Map Sitecore rendering component name to an implementation
  2. What does sitecore.json do
    Specifies what CLI plugins were installed and specifies location of json files containing serialization info
    “modules”: [
    “src/path/to/.module.json”
    ]
  1. What does module.json do
    Must be added to all folders where serialization takes place
    Specifies what path must be serialized
    Without module.json file, or if it doesn’t contain the paths = no serialization
    Sitecore Content Serialization (SCS) comes with module.json based configurations
  1. Sitecore CLI vs Sitecore for VS
    both are compatible – within one team one person might use CLI while the other uses VS
  1. What is the Sitecore Container Registry
    It contains the base container images for production and development
  1. When would you use HOST_LICENSE_FOLDER instead of SITECORE_LICENSE
    When there is an error compressing the license file into a zip folder – SITECORE_LICENCE must contain the zipped version
  1. Which renderings are “in-line editable”
    Singleline, Image, Datetime
  1. What is the purpose of a .env file when deploying Sitecore to containers
    The .env file allows you to declare environment variables for your Docker containers
  1. What is the primary function of the Layout Service
    To provide structured data about Sitecore-based pages including components and their associated content
  1. When using Sitecore Content Serialization, what is the sitecore.json file in your development solution
    The configuration file for global development plugins and module locations
  1. Match Pair.
    Serialization using commands -> CLI
    Serialization using GUI -> Sitecore for VS
    Where Sitecore pipeline etc sits -> Platform project in starter template
    Where front end files sits -> RenderingHost project in starter template
  1. What is the relation between CD server and Rendering host
    Layout service in hosted in CD which provide data to rendering host via Layout Service client
  1. When you use the field helper, what do you do when you want to ensure that a field cannot be editable inline? or
    With Sitecore MVC, how do you ensure that a field cannot be editable inline
    a. Set the Editable parameters to False
    b. Choose a non-editable equivalent field type
    c. Marke the field as non-editable in the field definition item
    d. Use the DisableWebEdit option
  1. You have been hired to create a company’s website and as you prepare you must define the data structures in Sitecore to create items and content, what should you use to define data structure?
    a. Template
  1. Which statement characterizes the Sitecore extranet security domain
    It is a domain that contains user account as well as customize roles for managing read access to website.
  1. Log in to Sitecore CM shell from multiple host name
    Add allowedCorsOriginsGroup for each site
  1. Which of the following info is available in workbox
    Available workflow commands divided by associated workflow
  1. Sitecore approach to assign user permission
    Permissions are assigned to roles and users are placed in the roles
  1. Users have been assigned a new role and can no longer access the items in the content tree that were previously accessible.
    new use have role which is denied by other role and sitecore prioritize the deny rule
  1. Recommended practice for storing reusable content that is shared between different sites
    Store it outside of any one sites content tree structure
  1. What should you do to ensure that items created from a template have the title field populated with name of the item
    $name token to template standard values title field
  1. You are reviewing content items created from different templates within Sitecore and recognize that the individual items all have a section titled “General Information” with the same three fields Header, Title and Description. If the templates were designed following the best practices, what does this indicate about templates these items are created from?
    The data template for these items inherit from a base template containing the three fields within the “General Info” section
  1. You are working with another developer who has 2 templates with a rich text field name Description. You want content authors to be able to change the font size in the description field on items created from one template but not another. Should the developer define the description field in common parent template?
    No, because 2 fields use different sources
  1. Which of these is a complex field
    Checkbox
  1. You have 3 rendering options with a complex datasource query. In order to swap the existing rendering with a new one, you have to copy the datasource query, remove old rendering, insert new one, paste the datasource query. What should you do to reduce these steps?
    Add each rendering to compatible renderings option
  1. You modify a file in your visual studio project outside the webroot folder. How to see those changes within the Sitecore installation
    Copy files to wwwroot using Visual Studio’s Publish command
  1. In sitecore MVC which static class contains info about any current http request
    Sitecore.Context
  1. Relationship between rendering host and content delivery role in Sitecore headless SDK
    Content delivery hosts the headless service which is used by Rendering Host to fetch the content and layout
  1. How does content serialization support the development experience
    By allowing developers to easily move and share developer-owned items across different environments
  1. Which 2 statements about Sitecore serialization are true
    Sitecore CLI and Sitecore for visual studio provide the same serialization functionality but with different interfaces
    Regardless of personal choice, Developers on the same team can use either tool, Sitecore CLI and Sitecore for visual studio will full compatibility
  1. Tow docker files
    Docker-compose.yml and .env
  1. You want to set limitation of the navigation item that the item itself and the items one step below it should serialized. How to set this limitation?
    Scope
  1. ASP.NET Core Rendering SDK – which type of view should be used for structural data with multiple placeholders
    Partial View

Sitecore 9 Certification Questions

  1. Which of these tools is designed for non-technical content author?
    a. Sitecore Rocks
    b. Experience Analytics
    c. Content Editor
    d. Experience Editor
  1. What is the main purpose of a Web Content Management System?
    a. Offers a Content Storage System
    b. Allow Non-Technical user to administer the content of a website
    c. Provides log in functionality to a website
    d. Speed up the performance of a web server
  1. Match the following Statement – Direct Answer
    All Product & modules for Sitecore Experience Platform 8.0 can be downloaded from – The Sitecore Developer Portal
    Video Tutorial is available from – The Master Sitecore Youtube Channel
    You can contribute to the learning community by adding to the – The Sitecore Marketplace
    All product documentation prior to Sitecore Experience Platform 8.0.can be downloaded from – The Sitecore Developer Network
  1. Why does Sitecore have both a Master and Web Database?
    a. To allow editing content in a sandbox without affecting the content on the live site
    b. To separate your own configuration from the standard one that comes with Sitecore
    c. To make version upgrade much easier
    d. To able to have multiple servers delivering your live site content
  1. From which template should items eventually inherit in Sitecore
    a. Content Template
    b. Standard template
    c. Layout definition template
    d. Base Content
  1. Why icons on templates important
    a. Because all the existing data templates have icons
    b. Because in Sitecore, the data templates will not work without an icon
    c. Icon helps users create an attractive look and feel for their websites
    d. Icons make it much easier to identify the different item types
  1. What is the purpose of the Standard Templates?
    a. To define fields that Sitecore users internally but are not shown to the user
    b. To define the overall structure of your page
    c. To define default values for templates
    d. To define some fields, you will need in all your pages, title, text, keywords etc.
  1. Which of the following best describes the purpose of the Field Source in Sitecore?
    a. The Field source is only used to restrict a user’ access to folder and files
    b. The field source defines how fields appears in the UI
    c. The Field source allows the configuration of extra properties in templates field definition
    d. A field source maps a field to the underlying class representation in the API
  1. How can you populate the property of a ViewModel and still support inline editing in the Experience Editor?
    a. By wrapping the entire markup in a Sitecore Edit Frame
    b. By using the Render() method in the FieldRender class
    c. By using an object from the FieldCollection
    d. By using the appropriate field class as the type of the property
  1. Which of the following fields is editable inline in the Experience Editor?
    a. Checkbox
    b. Multilist
    c. Droplink
    d. Datetime
  1. What is the advantage of using components?
    a. You can include content from Sitecore
    b. You can have different output depending on the device requesting the page
    c. Your presentation artifacts are more reusable
    d. It allow content to be editable inline the Experience Editor
  1. How can you define rendering as compatible
    a. Having them in the same Allowed Controls field of the placeholder
    b. Ensuring they have the same name prefix
    c. Adding an attribute in their implementation file
    d. Modifying a field in their component definition item
  1. What does Sitecore store the Rendering Parameters
    a. Fields that have registered with the component
    b. Any Sitecore Field
    c. Fields that contains simple values: single-line-text, checkbox or integer
    d. Only fields that support edit frames
  1. What is the raw value of a field?
    a. The binary representation of the contents of the field
    b. The value returned by the FieldRendered
    c. The value the user typed in the Content Editor
    d. The value of the field as stored in the database
  1. When would you render the raw value of a field to the website?
    a. When it does not contain XML
    b. When the field value is not null
    c. Never render a raw value to the website
    d. When it contains HTML encoded content
  1. What is the purpose of a Field Editor Button?
    a. To allow author to change the field type
    b. To open a pop up where field are edited
    c. To open the Rich Text Editor for a field
    d. To enable editing of image field in the Experience Editor
  1. Which class can you use to access the contents of a TreeList field?
    a. MulitlistField
    b. TreelistField
    c. GenericField
    d. TreelistExField
  1. Which of the following field type can be edited inline in the Experience Editor?
    a. Multilist with Search
    b. Check box
    c. General Link
    d. File
  1. Why would you make an item into a bucket?
    a. In order to group items that relate to the same functional area
    b. If it will have a large number of descendant
    c. So that all its descendants are published at the same time
    d. If you want to allow user to be able to search for descendant
  1. Why would an item show in the content tree even though it is a child of a bucket item?
    a. It is not marked as hidden
    b. It is not bucketable
    c. It was created after the bucket was created
    d. It lack the item: bucket security permission
  1. What is the advantage of setting StorageType=Yes in an index field?
    a. The index will take less space
    b. Update index operations will be faster
    c. The tokenization process wil be more efficient
    d. There is no need to access Sitecore database to query its value
  1. For performance reason it is best to
    a. Index everything for fast search results
    b. Set StorageType=Yes as often as possible
    c. Index only parent item to keep the index size manageable
    d. Add only what is required to the index
  1. In a view, what do you need to do soothe Field() extension method retrieves the content from the datasource?
    a. Pass a second parameter : Field(“fieldname”, Model.Rendering)
    b. Pass an anonymous object with the item reference: Field(“fieldname” new {item=Datasource})
    c. Nothing that is the default behavior
    d. You have to use the FieldRender as the Field method can’t do that.
  1. How can you retrieve the Datasource in a view rendering with the default model?
    a. Model.RenderingContext.Item
    b. Model.Datasource
    c. Model.Item
    d. Model.Rendering.Item
  1. What part of Sitecore is in charge of generating URLs?
    a. DataProvider
    b. UrlProvider
    c. LinkDatabase
    d. LinkManager
  1. When you are working with a Sitecore.Data.Items.Item object, how do you get a list of all its children (first-level-descendants)?
    a. By using .Axes.GetDescendants()
    b. By using .GetChildren()
    c. By using Database. .GetChildren()
    d. By using .Axes.GetChild()
  1. How can you get Sitecore to produce translated URLs?
    a. By setting the LinkManager to use the item’s DisplayName
    b. By using the languageLocation attribute of the LinkManager
    c. By using the FetFriendlyUrl method
    d. By configuring the EncodedNameReplacements
  1. When you are working with a Sitecore.Data.Items.Item object, how do you get a reference to its parent item?
    a. .Axes.Paranet
    b. .GetParent()
    c. .ParentItem
    d. .Parent
  1. How can you make sure that you can undo a package installation?
    a. Create an Undo Package when you create the package
    b. Create an Anti-Package when you install with Sitecore Rocks
    c. Install the Package Uninstaller module
    d. A package installation cannot be undone.
  1. Why would you define Sitecore package?
    a. You need to copy an entire database between environments
    b. You need to copy certain items/files from one Sitecore installation to another
    c. You need to publish the changes made y an author
    d. You want to deploy a new Content Delivery instance.
  1. You are setting up Sitecore instance to accommodate three public facing websites. Where will you map which home item corresponds to each hostname?
    a. In the Core database
    b. In the /system/settings section of the Master database
    c. In the IIS Website definition settings
    d. In a Config include file patching the web.config
  1. When you patch in changes to the Sitecore.config file through include Files, which order are your changes applied?
    a. In App_Config create entries in the patchOrder.config file
    b. Using the priority attribute when you create the change
    c. According to the updated date timestamp of the include File
    d. Alphabetically according to the name of the files and subfolder
  1. How to scale SiteCore vertically?
    Provide dedicated server to specific component
  1. Template A and Template B is inherited in other template. What will be the output?
    All fields from A + All Fields from B
  1. One Filed name is same in both template A and Template B. what will be if both inherited in another template?
    Both filed will be displayed in template. Same field definition should be avoided in multiple templates.
  1. When opened item in content editor how to check that item is based on which template?
    Quick info section
  1. When open item in content editor How to check corresponding template’s template inheritance chain.
    By opening item’s template
  1. Code has written using ContentSearch API to fetch Index but getting compilled error. What can cause this issue?
    Reference not added to ContentSearch.dll
  1. Which assembly .GetItem() method belong to? Or Sitecore Mostly API resides in which dll
    Sitecore.Kernel
  1. How Url is generated?
    Sitecore.Links.LinkManager.GetItemUrl(“path”)
  1. Why we upload media file into sitecore?
    Media items and media become publishable
  1. How do you display the contents of a field in code?
    @Html.Sitecore().Field(“”)
    Or
    @Html.Sitecore().Field(“Title”)
  1. How would you render the content of a single line text field called Title?
    a. @Model.Field(“Title”)
    b. @Html.Sitecore(“Title”)
    c. @Html.Sitecore.Field(“Title”)
    d. @Html.Text(“Title”)
  1. When you use the field helper, what do you do when you want to ensure that a field cannot be editable inline?
    a. Set the Editable parameters to False
    b. Choose a non-editable equivalent field type
    c. Marke the field as non-editable in the field definition item
    d. Use the DisableWebEdit option
  1. Rendering Component Properties – Parameter
    @Model.Rendering Parameters[“CssClass”]
    @RedneringContext.Current.Redering.Parameters[“ButtonText”]
  1. What are the SIM installation features?
    Install any version of Sitecore from a repository of installers, install modules and packages, Reinstall the same configuration.
    Install any version of Sitecore from a repository of installers, install modules and packages, Create a new configuration.
    Install any version of Sitecore from a repository of installers, Install modules and packages, Reinstall a different configuration.
    None of the above