Daily discoveries, observations, frustrations, aha moments in a life of a .Net/Sitecore developer. Read at your own risk.
Tuesday, December 2, 2014
Let's "dotStep" into their code
I've used dotPeek for a while to look at source code of third party decompiled assemblies but this time I decided to experiment with actually stepping into their code. There are numerous resources out there, such as
https://confluence.jetbrains.com/display/NETCOM/dotPeek+Symbol+Server+and+PDB+Generation
http://msdn.microsoft.com/en-us/library/ms241613.aspx
and many others. Setting up Visual Studio options is straightforward until you feel you know enough to change things a bit. That's what I did and that's what caused me some trouble. BUT by going through that helped me understand the process better.
In the above diagram there are two paths: one for symbols cache directory in Visual Studio Tools > Options > Debug and the other in dotPeek. They have to match. The other crucial moment is if you choose Automatically Load symbols for "only specified modules" you have to make sure you spell the dll's name correctly. In the example above it is the Sitecore kernel and it has to contain the extension (.dll).
Many blogs omit describing the step of actually setting a breakpoint in decompiled source code. You can see it in the above image (notes in blue). Debug > New Breakpoint > Break and function and then type in the method name with the namespace and class (for example: Sitecore.Security.Accounts.IsAuthenticated). And hit F5. The process takes a while even if you have only Specified assemblies checked in VS and same in dotPeek. Patience better be your main virtue...and vuala - you get your breakpoint hit! Congratulations! You can now verify that's it's not YOUR code that breaks everything. it's THEIRS, you know what I mean? ;) Enjoy!
Wednesday, November 5, 2014
A little birdie told (tweeted) me
Out of the box Social Connected module has 5 social networks you can use: Facebook, LinkedIn, Google, Twitter and Social Marketer. I am not familiar with the fifth one so I decided to experiment with the first 4. Here is the summary of my success/failures/findings.
Facebook. Login was straightforward to implement out of the box. See my earlier blog for details. Posting goal messages to a FB timeline is not available unless publish_actions permission is requested by the app. In order to obtain this one has to submit the app for approval and that involves completing more steps than I wanted to because the main advantages of the Social module are:
1. Easy registration process
2. Obtaining wealth of personal information from Facebook for personalization on the site
I have those two at my disposal and decided to stop right there.
Twitter. Did not get the Login to work. I suspect (have not confirmed yet) that it's related to fact that the url is local. See notes on Google several lines down. I have a feeling they are related.
LinkedIn. Login functionality was a snap. Getting personal data. Nice and easy.
Google does not allow local urls for login. Rules are rules. Nothing I can do.
Facebook. Login was straightforward to implement out of the box. See my earlier blog for details. Posting goal messages to a FB timeline is not available unless publish_actions permission is requested by the app. In order to obtain this one has to submit the app for approval and that involves completing more steps than I wanted to because the main advantages of the Social module are:
1. Easy registration process
2. Obtaining wealth of personal information from Facebook for personalization on the site
I have those two at my disposal and decided to stop right there.
Twitter. Did not get the Login to work. I suspect (have not confirmed yet) that it's related to fact that the url is local. See notes on Google several lines down. I have a feeling they are related.
LinkedIn. Login functionality was a snap. Getting personal data. Nice and easy.
Google does not allow local urls for login. Rules are rules. Nothing I can do.
Tuesday, October 28, 2014
Privacy, please. Social Connected Module: Facebook.
After a relatively easy ride with Facebook login I encountered some challenges getting Social Connected to post messages to my test FB account's timeline when a DMS goal has been achieved. In addition to Sitecore documentation on the module I used Dan Solovay's blog http://www.dansolovay.com/2012/09/a-look-at-sitecore-social-connected.html and various other blogs I could find by googling the topic.
The first thing that cought my eye once I attempted to log with with Facebook the first time was this message at the bottom of the authorization popup:
But that is EXACTLY what I wanted to do! Post to Facebook. I proceeded with authorization anyway to see if the login works as expected. And it does. No problems there.
Next step was to make a goal with a message that would get posted to my FB account once the goal is achieved. I could see that the goal was being achieved but no message was added to the wall. I poured over Facebook documentation and found this interesting bit of information on a permission called "
https://developers.facebook.com/docs/facebook-login/permissions/v2.1
"Your app can ask for additional permissions at any time, even after a person logs in for the first time. For example, the
Is this what I am missing? I went to my app's settings to add this permission
And that required a whole new set of tasks I had to do on my app. One of them was adding a Privacy Policy URL. I made one up /privacy but it got rejected.
I can't believe I really need this but at this point it feels like I do. How is FB going to verify a privacy page on a local site? There's no way. I have to use something else.
To be continued...
The first thing that cought my eye once I attempted to log with with Facebook the first time was this message at the bottom of the authorization popup:
But that is EXACTLY what I wanted to do! Post to Facebook. I proceeded with authorization anyway to see if the login works as expected. And it does. No problems there.
Next step was to make a goal with a message that would get posted to my FB account once the goal is achieved. I could see that the goal was being achieved but no message was added to the wall. I poured over Facebook documentation and found this interesting bit of information on a permission called "
publish_actions
" at this location:https://developers.facebook.com/docs/facebook-login/permissions/v2.1
"Your app can ask for additional permissions at any time, even after a person logs in for the first time. For example, the
publish_actions
permission lets you post to a person's Facebook Timeline. "Is this what I am missing? I went to my app's settings to add this permission
And that required a whole new set of tasks I had to do on my app. One of them was adding a Privacy Policy URL. I made one up /privacy but it got rejected.
I can't believe I really need this but at this point it feels like I do. How is FB going to verify a privacy page on a local site? There's no way. I have to use something else.
To be continued...
Monday, October 27, 2014
Let's get Social. Social Connected Module 2.1
Today I have been playing with Social Connected Module 2.1 (http://sdn.sitecore.net/Products/Social%20Connected%20Module/Social%20Connected%202,-d-,1.aspx)
First thing I noticed is that I had to install the module manually even though I remember that I selected Social Connected as an optional install during local Sitecore instance installation process through SIM. Then when I was installing the module manually I kept getting this error
I found out later that Sitecore 7.2 is does not work with Social Connected. There is a workaround however. A couple of config file tweaks and we are good to go.
https://kb.sitecore.net/articles/715286
I decided to start with a Facebook. Made an app, just like the documentation prescribes, but noticed that the console in Facebook for app settings looks different from what they show in the doc. I entered by basic App info but was getting an error about app domain. This is how I fixed it:
In Settings > Basic I clicked Add Platform, chose Web Site and entered my site's domain. After that I repeated it in the App Domains field in the same Settings > Basic area. Saved my changes.
Then I added a Facebook button to my page (following instructions) and was able to log in with my FB credentials. What happens upon logging in are two things:
1. A record in a table gets created for me as a user
2. A sitecore user is created as well in User Manager
To make an app public the email address was mandatory in the app's Settings section.
Friday, October 24, 2014
Multivariate Testing continued....
I feel victorious! My MV test is finally working! Here is what happened. I created a test with two variants. In Page Editor, as instructions suggested. Started the test. But could not see the second variant popping up no matter what I did. I used different browsers, I wiped out all my cookies, I "gave it time", I changed the cache expiration in.
<setting name="WebEdit.TestStatisticsCacheExpiration" value="00:00:00"/>
I jumped on one foot. Nothing worked.
Then I remembered that in the section where it describes creating test in the Content Editor (which they advised NOT to do) it mentions something about test strategy. I find it strange that they didn't put that info in the section on the correct test configuration, in Page Editor. But anyway...
Sticky means that the same editor would keep seeing the same variant of a component.
Random means Sitecore would pick one of the components at random regardless of a visitor.
That still doesn't fully explain to me why I was not able to see the second variant at least once, since I was using various browsers and deleting cookies. But it is what it is: once I changed that setting on the standard values for the test definition template - my test worked. One more thing: PUBLISH the test.
A limitation I found: testing is page based and doesn't allow the client to get an overview of the tests running on the site and/or how they perform.
Goals
Goals seem to be pretty straightforward if they are on content items. Media items, however, turned out to be a bit more tricky. Once goal is created, published and deployed (in this exact order) it can be attached to "any" item according to documentation. And the engagement value points set in this goal would count toward the total visit engagement value. Not so fast. So far in my experiments with Launchsitecore I can only see my goal achieved in the list of goals but the total engagement value is not being updated. I thought I had some particularities in the code that prevented displaying the entire engagement score but all it's doing is Tracker.CurrentVisit.Value.
<setting name="WebEdit.TestStatisticsCacheExpiration" value="00:00:00"/>
I jumped on one foot. Nothing worked.
Then I remembered that in the section where it describes creating test in the Content Editor (which they advised NOT to do) it mentions something about test strategy. I find it strange that they didn't put that info in the section on the correct test configuration, in Page Editor. But anyway...
Sticky means that the same editor would keep seeing the same variant of a component.
Random means Sitecore would pick one of the components at random regardless of a visitor.
That still doesn't fully explain to me why I was not able to see the second variant at least once, since I was using various browsers and deleting cookies. But it is what it is: once I changed that setting on the standard values for the test definition template - my test worked. One more thing: PUBLISH the test.
A limitation I found: testing is page based and doesn't allow the client to get an overview of the tests running on the site and/or how they perform.
Goals
Goals seem to be pretty straightforward if they are on content items. Media items, however, turned out to be a bit more tricky. Once goal is created, published and deployed (in this exact order) it can be attached to "any" item according to documentation. And the engagement value points set in this goal would count toward the total visit engagement value. Not so fast. So far in my experiments with Launchsitecore I can only see my goal achieved in the list of goals but the total engagement value is not being updated. I thought I had some particularities in the code that prevented displaying the entire engagement score but all it's doing is Tracker.CurrentVisit.Value.
Thursday, October 23, 2014
MV TESTING
Followed the steps in the documentation. Seems really nice and simply. One interesting point: MV test takes precedence over personalization. What I mean is this: if I have personalization set up on a component, for example if my pattern is Developer I see "Welcome to out Developers!" text widget. But if I am a Marketer I see "Welcome to our Marketers!" copy. But in my test I have a third copy "Welcome to all!". When I run my test on this page even though the text widget is configured to change its content (text) depending of a visitor pattern it won't! Because the logic behind the test is to flip copy to a different variant, without keeping track of patterns.
As I write this I am running a test and periodically hopping all over the site to see a different copy but so far I haven't...Not a good thing. Where is my next variant? BRB
Ok..I don't like this. I only see the first variant. Either my test is configured to proceed to next variant after a certain time that hasn't expire yet OR...I have no clue why it's not doing it :(
As I write this I am running a test and periodically hopping all over the site to see a different copy but so far I haven't...Not a good thing. Where is my next variant? BRB
Ok..I don't like this. I only see the first variant. Either my test is configured to proceed to next variant after a certain time that hasn't expire yet OR...I have no clue why it's not doing it :(
Wednesday, October 22, 2014
DMS Profiling, Personalization Based on a Pattern Card
I continue to swim in the open waters of Sitecore Digital Marketing System.
PROFILING. I know, it's not politically correct but I'll do it anyway. I set a new profile and made 4 profile cards and 4 pattern cards. My questions form the start was: are they related? Do engagement value points have to match one for one between them? The answer seemed to be no, but I was not able to see the patter matching happening. I was clicking on all the right pages (developer) but none of the patterns seemed to match. Until I updated the value points to be exactly the same between corresponding cards and patterns.
I.E. Profile card called Developer has values 1,2, 7, therefore Pattern card for Developer should also have 1,2, 7 for engagement value points.
I discovered that visitor's profile changes as user navigates the site. I originally assumed that once it reaches a certain "status" it keeps it. But it doesn't. The pattern changes between the pattern cards defined on the site depending on which pages I click.
In the API you can get to the same profile collection two different ways. From the current visit itself or through a current visitor.
var visitorProfiles = Sitecore.Analytics.Tracker.Visitor.CurrentVisit.Profiles;
var visitProfiles = Tracker.CurrentVisit.Profiles;
Then to actually match the pattern I iterate though all profiles:
var personaProfile = Tracker.CurrentVisit.Profiles.Where(profile => profile.ProfileName == evaluatorTypeProfile.Name).FirstOrDefault();
if (personaProfile != null)
{
// load the details about the matching pattern card
Item patternCard = Sitecore.Context.Database.GetItem(new ID(personaProfile.PatternId));
if (patternCard != null)
{
//DO YOUR MAGIC HERE
}
}
PERSONALIZATION BASED ON A PATTERN CARD
This is such a quick and visual way personalize based on visitor's pattern. Once I had my profile and cards set up I made a custom condition on a component like this:
in Page Editor click the component. Click Personalize icon and make a new condition like this:
PROFILING. I know, it's not politically correct but I'll do it anyway. I set a new profile and made 4 profile cards and 4 pattern cards. My questions form the start was: are they related? Do engagement value points have to match one for one between them? The answer seemed to be no, but I was not able to see the patter matching happening. I was clicking on all the right pages (developer) but none of the patterns seemed to match. Until I updated the value points to be exactly the same between corresponding cards and patterns.
I.E. Profile card called Developer has values 1,2, 7, therefore Pattern card for Developer should also have 1,2, 7 for engagement value points.
I discovered that visitor's profile changes as user navigates the site. I originally assumed that once it reaches a certain "status" it keeps it. But it doesn't. The pattern changes between the pattern cards defined on the site depending on which pages I click.
In the API you can get to the same profile collection two different ways. From the current visit itself or through a current visitor.
var visitorProfiles = Sitecore.Analytics.Tracker.Visitor.CurrentVisit.Profiles;
var visitProfiles = Tracker.CurrentVisit.Profiles;
Then to actually match the pattern I iterate though all profiles:
var personaProfile = Tracker.CurrentVisit.Profiles.Where(profile => profile.ProfileName == evaluatorTypeProfile.Name).FirstOrDefault();
if (personaProfile != null)
{
// load the details about the matching pattern card
Item patternCard = Sitecore.Context.Database.GetItem(new ID(personaProfile.PatternId));
if (patternCard != null)
{
//DO YOUR MAGIC HERE
}
}
PERSONALIZATION BASED ON A PATTERN CARD
This is such a quick and visual way personalize based on visitor's pattern. Once I had my profile and cards set up I made a custom condition on a component like this:
in Page Editor click the component. Click Personalize icon and make a new condition like this:
where the current visit matches the Developer pattern pattern card in the Visitor Categories profile
Text in blue is my actual Pattern Card and Profile. Then for this condition I chose a different datasource. Reloaded the page and I checked my current pattern. Happened to be Developer, just like in the condition. And the text inside my personalized component changed accordingly. Success!
Subscribe to:
Posts (Atom)