10

In your AdditionalInfoFacet constructor, change this line: EnsureAttribute<string>(FIELD_OPT_IN); To this: EnsureAttribute<bool>(FIELD_OPT_IN); You need to register your boolean attribute with the correct type.


9

I do this using Experience Profile Express Tab code. It allows you to add a custom tab to the contact in experience profile. Then you just load your facet into it. You can put anything in the model. In the code below I am pushing 3 different facets into it. What the code does is looks for any model that is inheriting from the class EpExpressViewModel. If ...


8

The solution If you are sure that the contact currently has a session on the site, then you should NOT release it to the Collection Database. Instead, you should use this method: manager.SaveAndReleaseContact(lockedContact); This will save the contact data back to the Shared Session. All data will be saved to the Collection Database at the end of the ...


7

We use code like this and it works fine. It is similar to yours however there are some differences: using (var client = SitecoreXConnectClientConfiguration.GetClient()) { try { var identifier = new IdentifiedContactReference(IdentifierSources.Email, email); var contact = client.Get(identifier, new ContactExpandOptions(...


7

You need to perform the below steps to achieve this: Create a Custom Facet Model Register the Custom Facet Model Deploy Custom Facet model to XDB Add it to the Sitecore.XConnect.Client.Configuration In step 3, you need to place .JSON file at two places (You have placed it only one place): x-connect root path > App_data/Models x-connect root path > ...


6

The issue that you are seeing is because you are trying to instantiate a new ContactRepository(). The appropriate way to reference the repository is by creating the object through Sitecore's Configuration Factory. private ContactRepository _repository = Sitecore.Configuration.Factory.CreateObject("tracking/contactRepository", true) as ContactRepository; ...


6

With your code you are always changing facet value on contact so contact will be part of only one contact list (last one assigned) at the end. You are also effectively replacing all other list subscriptions to that particular contact. This is bad practice. You need to use this code snippet to achieve it: ListSubscriptions subscriptions = new ...


6

The code you are referencing is part of the process that details how List Manager, or the Marketing Operations of Sitecore, handles mapping imported CSV data to facets on a contact. At least that's the documentation link that you provided. The documentation link describes a generic scenario where the purpose of this mapping facet is to map the Personal and ...


6

Yes you can save custom facets for Anonymous contact as well. I have written a blog for creating and save custom facets, please refer both the blogs and verify if you missed anything. Create Custom Facet Model in Sitecore 9 Work with Custom Facet in Sitecore 9 A method CurrentTracker.Session.IdentifyAs() in Sitecore.Analytics interface, it is used to ...


6

We faced the same issue and raised Sitecore support ticket for the same and we get to know that if you try to hit from Postman, need to remove user-agent from postman headers like below - https://www.screencast.com/t/K0BiMxHv This was only happening on Sitecore 9.3, in Sitecore 9.0.2 it was working fine for us. Also, I wrote a blog about this you can check ...


5

The error I got in code behind when creating contact, on client.submit() is: "The type of this instance does not correspond to any type in the model". I was currently checking with Sitecore Support team as they found in the logs provided that my custom facet types in the custom model can't be found in Model.Types even they exist there. The solution they ...


5

You should use similar code as below one to fix your problems to get and set custom facet values: Contact contact = client.Get<Contact>( new IdentifiedContactReference(_contactSource, contactIdentifier), new ContactExpandOptions(DynamicDataFacet.DefaultFacetKey)); var list = new List<Data> { data }; if (contact != null) { var facet = ...


5

In the past I found that the only way I can do date search was to use the default start field from search field types. As you can see that it has the Start field and some date value and it does return the results. Also you can use the END date field there. Combination of those 2 date might help you achieve what you are looking for. You have another ...


5

When A Custom Facet Is Extended, Mongo Is Not Immediately Affected Just because Mongo isn't showing the added facet/element/attribute, doesn't mean that the Facet isn't there. MongoDB will only store Facet information if there is information to store. By adding an element to the Contact Facet model, that does not automatically update MongoDB directly. The ...


5

@VicentGaliana is exactly right. The difference between identifying a contact and creating a contact essentially boils down to whether or not you are able to "recognize" the contact. What is contact identification and why is it important? Think of a contact's session like short-term memory. The contact is here, and while the contact is here you remember ...


5

TL;DR No, just use that method, it's enough. Long answer In your case, Sitecore has already created a contact the first time it requested a page and tracked information against that contact. You may not see it in mongo yet if it's the first visit, but Sitecore has already created that contact in memory, as unknown and without an identifier, so there is no ...


5

Yes, you can have several 'MyCustomFacet' types under different facet keys. Can you please try like this, it will work for you: MyCustomFacet facetA = contact.GetFacet<MyCustomFacet>(MyCustomFacet.DefaultFacetKey); facetA = new MyCustomFacet { propertyA = "valueA", propertyB = "valueB" //and so on ...


5

Yes, we need to create a custom model class for CustomFacet with custom facet key. Then we deploy our custom model and serializes our custom facet model and we need to copy that custom JSON model to the xConnect location. After that, you need to create a patch file or register your DLL and class name with namespace into a schema tag into Sitecore.XConnect....


5

Ones you want to extend your contact model with the facet above, a code will look like below: JobPreference model: using System; using Sitecore.XConnect; using Sitecore.XConnect.Schema; namespace {your-namespace} { [Serializable] public class JobPreference { public JobPreference(Guid jobId, string jobName, int priorityValue) { ...


4

I think your solution to create a new collection in mongodb is a very viable solution. Then you can just query the collection to get the top 5 pages. I would not recommend to put it in xDB as a custom facet because it would be "difficult" to get top 5 pages, as you would have to query every single contact to find the pages. Even Sitecore does not do it ...


4

Anonymous visitor xDB data is stored according to the cookie guid that was placed on the visitors computer as SC_ANALYTICS_GLOBLE_COOKIE. As long as the user doesn't clear his cookies, subsequent visits/interactions will be tracked to that anonymous visitor. In the event that the user does self identify in some capacity, running Tracker.Current.Session....


4

Your collection getters need to access the actual collections by using proper keys: public IElementCollection<IHistoryChangeElement> Changes { get { return GetCollection<IHistoryChangeElement>(COLLECTION_CHANGE); } } public IElementCollection<IHistoryLocationElement> Locations { get { return ...


4

You need to register Address as your IAddress implementation in Sitecore configuration. You can see how it is done in Sitecore.Analytics.Model.config. Basically, you'd have a patch file along the lines of: <?xml version="1.0" encoding="utf-8"?> <configuration xmlns:patch="http://www.sitecore.net/xmlconfig/"> <sitecore> <model> ...


4

In general, you can look at the examples in the documentation for searching contacts by an interaction facet: https://doc.sitecore.net/developers/xp/xconnect//xconnect-client-api/search/contacts/index.html#search-by-interaction-facets I'm sure this is what you based your queries on, but including it for completeness. I notice in your code that you are ...


4

You should get a contact with expanded interactions which will contain page events. private async Task<IReadOnlyCollection<PageViewEvent>> GetAllPageEvents(Guid contactId) { var allInteractionsExpandOptions = new ContactExpandOptions() { Interactions = new RelatedInteractionsExpandOptions() { ...


4

Contact Identifiers are considered PII sensitive and are not indexed by default. To enable indexing of PII sensitive data, set IndexPIISensitiveData to true for xConnect index worker which is typically installed under xConnect website. Configuration file to update: App_data\jobs\continuous\IndexWorker\App_data\Config\Sitecore\sc.Xdb.Collection....


4

NOOOOOOOO Under most circumstances this is a horrible idea. The reason is if you change from a string to a bool or a string to an int, when the Newtonsoft deserializer runs in xConnect, it will result in this error. Sitecore.XConnect.Operations.DependencyFailedException: One or more dependencies failed ---> System.InvalidCastException: Specified cast is ...


3

Besides implementing the chorpo's code, please try enabling the indexing of anonymous contact data. To do that, please go to the following file locations of your xconnect site: \App_data\config\sitecore\SearchIndexer\sc.Xdb.Collection.IndexerSettings.xml \App_data\jobs\continuous\IndexWorker\App_data\Config\Sitecore\SearchIndexer\sc.Xdb.Collection....


3

API endpoint There is an api route for that (it is being used by exp. profile in fact): [host]/sitecore/api/ao/v1/contacts/search?pageSize=100&pageNumber=1&sort=visitCount%20desc&match=john This will search for name and email occurances. API method If you want to use your custom controller, you can use the below method from API: ...


3

You can force the contact email into xDB so it will be available during the session. Contact contact = Tracker.Current.Session.Contact; //update email in xDB var recipientRepository = RecipientRepository.GetDefaultInstance(); RecipientId recipientId = new XdbContactId(contact.ContactId); recipientRepository.UpdateRecipientEmail(recipientId, emailAddress); ...


Only top voted, non community-wiki answers of a minimum length are eligible