• About this blog
  • About me
  • Contact
Sitecore XperiencesThe things I've seen as a Sitecore Professional
  • About this blog
  • About me
  • Contact
Menu
  • About this blog
  • About me
  • Contact
  • Programmatically "Visit" a page (and all xDB-related)

    September 5, 2019 Rodrigo Peplau 0

    Yesterday during my presentation at the SUG-Quebec (check video here), my host and good friend Jeff L’Heureux asked if I could share the multiple challenges involved in the Smart Bookshelf for Sitecore Demo. In response to that, I’m putting together a number of articles, modules and other resources, to share how each of these things works.

    The present article shows how we can simulate a visit to a Sitecore page, along with all xDB-related events that happens when you actually do it. For instance, if your page has Profile Card(s) associated, then your contact should get points in that profile when the page is visited.

    The Smart Bookshelf has the following situation:

    Anthology Profile Cards

    As you can see, Genres have corresponding Profile Cards, so when a Genre page is visited, the corresponding Profile Card is summed up to the contact’s profile. This is how we can track and define the user’s preferred Book Genres.

    Now we want to apply the same Genre Profile Cards when the user visits a Book Page. Given that each book belongs to a single Genre, we don’t have to manually associate the Profile Card to individual books. Instead, we can use the following technique to simulate a visit to a Genre Page when a Book is visited.

     

    Enough talking – show me the code!

    Ozzy Rock

    So simple and easy, that you’ll probably want to kill me for the long intro

     

    Step 1 – Get the item you want to simulate a visit to

    In my case, Books are direct children of Genres, so all I have to do is to get the parent item:

    var bookItem = Sitecore.Context.Item;
    var genreItem = bookItem.Parent;

    Step 2 – Simulate the visit

    Go ahead and call the following static method:

    Sitecore.Analytics.Data.TrackingFieldProcessor.Process(genreItem);

    Thats it?

    Yes! You want it harder?

    Minions saying NO!

    Thought so ;)

    Categories: Analytics, xDB

    Index Searching - Find-Item using custom fields with Sitecore Powershell Custom rule condition to find Top-N Profile Key

    Leave a Reply Cancel reply

    Your email address will not be published. Required fields are marked *

      Am Not Spammer

    You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Proudly 8x Sitecore MVP (2016-2023) MVP 2016-2023

Localization

Recent Posts

  • Error enabling GraphQL IDE with XM Cloud
  • Meet MVPinny: the AI-Powered Sitecore Assistant
  • Content generation with Sitecore Connect and ChatGPT
  • XM Cloud Starter Kit with Content Hub Integration
  • Meet the (Brand new) Advanced Powershell Packaging Features

Recent Comments

  • navan on Meet MVPinny: the AI-Powered Sitecore Assistant
  • Adriana on Content generation with Sitecore Connect and ChatGPT
  • NAVAN on Automatic Sitecore NuGet upgrades with Powershell
  • Hedipo S Menezes on Corey Peplau wrote this - WFFM conflict with Unity DI and a lesson on how Sitecore community is so amazing
  • Rodrigo Peplau on ERROR [Content Testing]: Cannot find PhantomJS executable at ' (...) /data/tools/phantomjs/phantomjs.exe'. Aborting screenshot generation.

Archives

  • December 2023
  • November 2023
  • August 2023
  • July 2023
  • January 2023
  • February 2022
  • December 2021
  • November 2021
  • March 2021
  • July 2020
  • February 2020
  • September 2019
  • July 2019
  • April 2019
  • March 2019
  • December 2018
  • February 2018
  • January 2018
  • November 2017
  • September 2017
  • August 2017
  • July 2017
  • March 2017
  • February 2017
  • November 2016
  • September 2016
  • August 2016
  • July 2016
  • April 2016
  • November 2015
  • September 2015
  • July 2015
  • April 2015
  • March 2015
  • February 2015

Categories

  • Actions
  • Active Directory
  • Analytics
  • Architecture
  • Bug fixing
  • CDP/Personalize
  • ChatGPT
  • Content Edition Experience
  • Content Hub
  • Continuous Integration
  • Dev
  • Development
  • Environments
  • Experience Editor
  • Experience Forms
  • Front-end
  • Health Check builds
  • Helix
  • How To
  • LDAP
  • MVP
  • MVP Summit
  • Phantom JS
  • Powershell
  • QA
  • Richtext Editor
  • Rules
  • Security Provider
  • SIF
  • Sitecore 9
  • Sitecore API
  • Sitecore Community
  • SItecore Connect
  • Sitecore Modules
  • Sitecore Rocks
  • Sitecore Rule Processor
  • Sitecore Symposium
  • SPE
  • SPEAK
  • SUG
  • Support Ticket
  • TDS
  • Team City
  • Uncategorized
  • Upgrades
  • Visual Studio
  • WFFM
  • Workflow
  • XConnect
  • xDB
  • XM Cloud

Meta

  • Log in
  • Entries RSS
  • Comments RSS
  • WordPress.org

Recent Posts

  • Error enabling GraphQL IDE with XM Cloud
  • Meet MVPinny: the AI-Powered Sitecore Assistant
  • Content generation with Sitecore Connect and ChatGPT
  • XM Cloud Starter Kit with Content Hub Integration
  • Meet the (Brand new) Advanced Powershell Packaging Features
  • Rodrigo Peplau wins his 8th Sitecore MVP Award
  • Glossary: Sitecore CDP vs Sitecore XP
  • ReplaceHTML doesn’t work in Web Experiences with Sitecore Personalize
  • Sitecore Personalize: Difference between “Experiences” and “Experiments”
  • Automatic Sitecore NuGet upgrades with Powershell

Tag Cloud

    Architecture Automation Continuous Integration Debugging Development Environments Hackathon How To PhantomJS Powershell Server Roles TDS Team City Team Development for Sitecore XConnect

Pages

  • About this blog
  • About me
  • Contact

Search

Copyright © 2015 Rodrigo Peplau Theme created by PWT. Powered by WordPress.org