Closed meramez closed 5 years ago
Have found the bug - here - am using the wrong cookie name to check for the pages viewed. Must have introduced this in the re-work for version 8. Will get a fixed release out shortly for 7 and 8.
Hi @AndyButland great plugin. We are testing this with Umbraco 8.5.3 starter site and cant seem to get "Pages Viewed" to work. We've added a simple rule as above and I want to set a bool value within our site.
ie) var visitedContactPage = Umbraco.MatchesGroup("Contact Page visitors") ? "You have visited the Contact Page" : "You have NOT visited the Contact Page";
Are you able to check this please and also provide a few more examples. Thanks very much.
Have had a quick look @StudioBravo - and seems OK on my copy (an earlier version of V8). Maybe there's an issue with compatibility with the latest version, but it doesn't seem that likely given the Umbraco functionality in use here is fairly stable.
To check I've:
@{
var matchesGroupMessage = Umbraco.MatchesGroup("Viewed Test Page")
? "You are in the group"
: "You are NOT in the group";
}
<p>@matchesGroupMessage</p>
And this looks to behave as expected.
Hi @AndyButland We have tried again but still no luck with Umbraco 8.5.3 http://prntscr.com/r5xlh5 as you can see the relevant cookies are present and Node id 1118 is definitely the Contact Page from the starter kit.
The rule is a "per page request" and we have also tried with "per session" and "per visitor".
Please kindly check with version 8.5.3. Thanks.
I've just tried it @StudioBravo - and does seem OK to me. Have used 8.5.3, the starter kit and installed the most recent version of the package.
Just to double-check though, can you please share a screen-shot showing all details of the group you've created, and the exact code you are using in your template? Thanks.
Hi @AndyButland yes we created a Group called "Contact Page visitors" see : http://prntscr.com/r6odpn and have assigned that Group to the "About us" page. http://prntscr.com/r6oe2v
We too can see the correct cookies being created however the following code placed on any page always returns false. http://prntscr.com/r6oev1
` @{ var matchesGroupMessage = Umbraco.MatchesGroup("Contact Page visitors") ? "You are in the group" : "You are NOT in the group"; }
@matchesGroupMessage
`What you've shared does look fine and matches with what I've got too. Could you maybe share your database - the one using the starter kit - so I can connect up what I've got running here to it? Maybe that'll reveal something
Thank @AndyButland here you go : https://www.studiobravo.com.au/files/Umbraco8Personalisation.zip
Thanks, have found the issue. There's an expectation in the code-base that the "Personalisation Groups" folder is in the root of the content tree. In your setup, it's under "Home". I've tried moving it to the root and then things look to work as expected, so hopefully you can just do that too.
I'm facing an issue with the Pages Viewed criteria, the personalisationGroupsPagesViewed cookie has the correct values of the pages IDs the user has visited, the action on the customizable page is not firing correctly, also the @Umbraco.MatchesGroup("some group") always turns to be false.
For reference, Umbraco 7.14, I used the CodeShare starter kit, added the personalisation group picker to the "Article" doc type, created a Personalisation Group in the Personalisation Groups Folder which checks for visiting the about page, selected this Personalisation Group from an article, added the ".Where(x => x.ShowToVisitor())" to the list building code on Partials/Content/_LatestArticles.cshtml
IEnumerable<IPublishedContent> articles = articleList.Children.Where(x => x.IsVisible() && x.DocumentTypeAlias == "article").Where(x => x.ShowToVisitor()).OrderByDescending(x => x.GetPropertyValue<DateTime>("articleDate"));