Skip to content

Commit ae853c3

Browse files
author
Jack Spektor
committed
Initial commit
1 parent bae1ef6 commit ae853c3

39 files changed

+2307
-0
lines changed

.gitattributes

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
###############################################################################
2+
# Set default behavior to automatically normalize line endings.
3+
###############################################################################
4+
* text=auto
5+
6+
###############################################################################
7+
# Set default behavior for command prompt diff.
8+
#
9+
# This is need for earlier builds of msysgit that does not have it on by
10+
# default for csharp files.
11+
# Note: This is only used by command line
12+
###############################################################################
13+
#*.cs diff=csharp
14+
15+
###############################################################################
16+
# Set the merge driver for project and solution files
17+
#
18+
# Merging from the command prompt will add diff markers to the files if there
19+
# are conflicts (Merging from VS is not affected by the settings below, in VS
20+
# the diff markers are never inserted). Diff markers may cause the following
21+
# file extensions to fail to load in VS. An alternative would be to treat
22+
# these files as binary and thus will always conflict and require user
23+
# intervention with every merge. To do so, just uncomment the entries below
24+
###############################################################################
25+
#*.sln merge=binary
26+
#*.csproj merge=binary
27+
#*.vbproj merge=binary
28+
#*.vcxproj merge=binary
29+
#*.vcproj merge=binary
30+
#*.dbproj merge=binary
31+
#*.fsproj merge=binary
32+
#*.lsproj merge=binary
33+
#*.wixproj merge=binary
34+
#*.modelproj merge=binary
35+
#*.sqlproj merge=binary
36+
#*.wwaproj merge=binary
37+
38+
###############################################################################
39+
# behavior for image files
40+
#
41+
# image files are treated as binary by default.
42+
###############################################################################
43+
#*.jpg binary
44+
#*.png binary
45+
#*.gif binary
46+
47+
###############################################################################
48+
# diff behavior for common document formats
49+
#
50+
# Convert binary document formats to text before diffing them. This feature
51+
# is only available from the command line. Turn it on by uncommenting the
52+
# entries below.
53+
###############################################################################
54+
#*.doc diff=astextplain
55+
#*.DOC diff=astextplain
56+
#*.docx diff=astextplain
57+
#*.DOCX diff=astextplain
58+
#*.dot diff=astextplain
59+
#*.DOT diff=astextplain
60+
#*.pdf diff=astextplain
61+
#*.PDF diff=astextplain
62+
#*.rtf diff=astextplain
63+
#*.RTF diff=astextplain

LICENSE

Lines changed: 674 additions & 0 deletions
Large diffs are not rendered by default.

Lib/Sitecore.Kernel.dll

4.7 MB
Binary file not shown.

Lib/Sitecore.Logging.dll

190 KB
Binary file not shown.

Lib/Sitecore.Update.dll

383 KB
Binary file not shown.

Lib/Sitecore.Zip.dll

23.3 KB
Binary file not shown.
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
2+
Microsoft Visual Studio Solution File, Format Version 12.00
3+
# Visual Studio 14
4+
VisualStudioVersion = 14.0.25123.0
5+
MinimumVisualStudioVersion = 10.0.40219.1
6+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SharedSource.ChromeAnalyticsDebugger", "SharedSource.ChromeAnalyticsDebugger\SharedSource.ChromeAnalyticsDebugger.csproj", "{38D68855-3A83-4912-9F50-FD4A4CB4C72D}"
7+
EndProject
8+
Project("{CAA73BB0-EF22-4D79-A57E-DF67B3BA9C80}") = "SharedSource.TDS.ChromeAnalyticsDebugger", "SharedSource.TDS.ChromeAnalyticsDebugger\SharedSource.TDS.ChromeAnalyticsDebugger.scproj", "{F6FA06D1-8CD3-4924-BEC1-43064FD008F7}"
9+
EndProject
10+
Global
11+
GlobalSection(SolutionConfigurationPlatforms) = preSolution
12+
Debug|Any CPU = Debug|Any CPU
13+
Release|Any CPU = Release|Any CPU
14+
EndGlobalSection
15+
GlobalSection(ProjectConfigurationPlatforms) = postSolution
16+
{38D68855-3A83-4912-9F50-FD4A4CB4C72D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
17+
{38D68855-3A83-4912-9F50-FD4A4CB4C72D}.Debug|Any CPU.Build.0 = Debug|Any CPU
18+
{38D68855-3A83-4912-9F50-FD4A4CB4C72D}.Release|Any CPU.ActiveCfg = Release|Any CPU
19+
{38D68855-3A83-4912-9F50-FD4A4CB4C72D}.Release|Any CPU.Build.0 = Release|Any CPU
20+
{F6FA06D1-8CD3-4924-BEC1-43064FD008F7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
21+
{F6FA06D1-8CD3-4924-BEC1-43064FD008F7}.Debug|Any CPU.Build.0 = Debug|Any CPU
22+
{F6FA06D1-8CD3-4924-BEC1-43064FD008F7}.Debug|Any CPU.Deploy.0 = Debug|Any CPU
23+
{F6FA06D1-8CD3-4924-BEC1-43064FD008F7}.Release|Any CPU.ActiveCfg = Release|Any CPU
24+
{F6FA06D1-8CD3-4924-BEC1-43064FD008F7}.Release|Any CPU.Build.0 = Release|Any CPU
25+
{F6FA06D1-8CD3-4924-BEC1-43064FD008F7}.Release|Any CPU.Deploy.0 = Release|Any CPU
26+
EndGlobalSection
27+
GlobalSection(SolutionProperties) = preSolution
28+
HideSolutionNode = FALSE
29+
EndGlobalSection
30+
EndGlobal
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Linq;
4+
using System.Web;
5+
using Sitecore.Analytics.Tracking;
6+
7+
namespace SharedSource.ChromeAnalyticsDebugger
8+
{
9+
public class AnalyticsDataModel
10+
{
11+
public AnalyticsDataModel()
12+
{
13+
ProfileValues = new List<AnalyticsProfileValue>();
14+
MatchedProfiles = new List<AnalyticsMatchedProfile>();
15+
}
16+
17+
public List<AnalyticsProfileValue> ProfileValues { get; set; }
18+
public int VisitValue { get; set; }
19+
public int PageCount { get; set; }
20+
public List<AnalyticsMatchedProfile> MatchedProfiles { get; set; }
21+
public ContactLocation GeoDetails { get; set; }
22+
public string ContactIdentifier { get; set; }
23+
}
24+
25+
public class AnalyticsMatchedProfile
26+
{
27+
public string ProfileName { get; set; }
28+
public Guid? PatternId { get; set; }
29+
public string PatternName { get; set; }
30+
public List<KeyValuePair<string, float>> Values { get; set; }
31+
public float Total { get; set; }
32+
}
33+
34+
public class AnalyticsProfileValue
35+
{
36+
public string ProfileName { get; set; }
37+
public Guid ProfileId { get; set; }
38+
public List<KeyValuePair<string, float>> Values { get; set; }
39+
}
40+
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<!-- THIS FILE SHOULD BE IN A SEPARATE FOLDER TO BE APPLIED AFTER ALL PATCHES IN APP_CONFIG\INCLUDE FOLDER -->
2+
3+
<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/">
4+
<sitecore>
5+
<settings>
6+
<setting name="Analytics.ChromeDebugger.UseSecret" value="true"></setting>
7+
<setting name="Analytics.ChromeDebugger.SecretKey" value="abc"></setting>
8+
</settings>
9+
<pipelines>
10+
<startTracking>
11+
<processor type="SharedSource.ChromeAnalyticsDebugger.Pipelines.AddChromeAnalyticsHeaders, SharedSource.ChromeAnalyticsDebugger"/>
12+
</startTracking>
13+
</pipelines>
14+
</sitecore>
15+
</configuration>
Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Data;
4+
using System.Linq;
5+
using System.Web;
6+
using Sitecore;
7+
using Sitecore.Analytics;
8+
using Sitecore.Analytics.Data.Items;
9+
using Sitecore.Collections;
10+
using Sitecore.Configuration;
11+
using Sitecore.Data;
12+
using Sitecore.Data.Items;
13+
14+
namespace SharedSource.ChromeAnalyticsDebugger
15+
{
16+
public class PersonalisationHelper
17+
{
18+
19+
public static readonly ID ProfilesId = new ID("{12BD7E35-437B-449C-B931-23CFA12C03D8}");
20+
21+
public static List<ProfileItem> GetProfiles()
22+
{
23+
Item item = Context.Database.GetItem(ProfilesId);
24+
25+
if (item != null)
26+
{
27+
return item
28+
.GetChildren(ChildListOptions.None)
29+
.Select(i => new ProfileItem(i))
30+
.Where(i => i != null)
31+
.ToList();
32+
}
33+
return new List<ProfileItem>();
34+
}
35+
36+
public static string GetProfilePattern(string profileName)
37+
{
38+
var profiles = Tracker.CurrentVisit.Profiles;
39+
int minScoreCount = Settings.GetIntSetting("Analytics.Patterns.MinimalProfileScoreCount", 0);
40+
41+
var profileItem = PersonalisationHelper.GetProfiles().Where(i => i.NameField == profileName).FirstOrDefault();
42+
43+
44+
var row = profiles[profileItem.ProfileName];
45+
46+
//If any profiles have a matched PatternLabel then check if it's the Pattern selected by the condition
47+
if (row != null && row.PatternId != Guid.Empty && row.Count > minScoreCount)
48+
{
49+
var patternItem = Context.Database.GetItem(ID.Parse(row.PatternId));
50+
return patternItem != null ? new PatternCardItem(patternItem).NameField : "Default";
51+
52+
}
53+
54+
var visitor = Tracker.Current.Contact;
55+
if (visitor == null)
56+
{
57+
return null;
58+
}
59+
60+
try
61+
{
62+
return visitor.Tags[profileName];
63+
}
64+
catch (DeletedRowInaccessibleException)
65+
{
66+
//Tag was deleted
67+
return null;
68+
}
69+
}
70+
71+
public static bool MatchedPattern(string profileName, string patternLabel)
72+
{
73+
try
74+
{
75+
if (Tracker.Current.Contact == null)
76+
{
77+
return false;
78+
}
79+
80+
var matchedPatterns = Tracker.Current.Contact.Tags[profileName+".Matched"];
81+
82+
if (string.IsNullOrEmpty(matchedPatterns))
83+
{
84+
return false;
85+
}
86+
87+
var patterns = matchedPatterns.Split(new[] { "," }, StringSplitOptions.RemoveEmptyEntries).ToList();
88+
89+
return patterns.Contains(patternLabel);
90+
}
91+
catch (DeletedRowInaccessibleException)
92+
{
93+
return false;
94+
}
95+
}
96+
97+
public static bool MatchesCurrentOrPreviousPattern(string profileName, string patternLabel)
98+
{
99+
var profilePattern = GetProfilePattern(profileName);
100+
101+
return profilePattern == patternLabel;
102+
}
103+
}
104+
}

0 commit comments

Comments
 (0)