1
0
Форкнуть 0

Merge pull request #1 from dotnet/screenview-screenname-addition

Overload to supply screenname on screenview and preserving value.
This commit is contained in:
Jaime Rodriguez 2017-02-01 17:19:56 -08:00 коммит произвёл GitHub
Родитель 556a8db431 9d69f78c5d
Коммит 079faf0de6
5 изменённых файлов: 23 добавлений и 6 удалений

Просмотреть файл

@ -86,9 +86,13 @@ namespace GoogleAnalytics
/// <summary>
/// Creates a screen view hit.
/// </summary>
public static HitBuilder CreateScreenView()
/// <param name="screenName">Specifies the 'Screen Name' of the screenview hit. Note: this will not affect subsequent hits. To do this, set the ScreenName property on the <see cref="Tracker"/> instead.</param>
public static HitBuilder CreateScreenView(string screenName = null)
{
return new HitBuilder(new Dictionary<string, string>() { { "t", HitType_Screenview } });
var data = new Dictionary<string, string>();
data.Add("t", HitType_Screenview);
if (screenName != null) data.Add("cd", screenName);
return new HitBuilder(data);
}
/// <summary>

Просмотреть файл

@ -328,7 +328,7 @@ namespace GoogleAnalytics
{
data[key] = value;
}
IDictionary<string, string> AddRequiredHitData(IDictionary<string, string> @params)
{
var result = new Dictionary<string, string>();

Просмотреть файл

@ -71,6 +71,14 @@ HitBuilder^ HitBuilder::CreateScreenView()
return ref new HitBuilder(data);
}
HitBuilder^ HitBuilder::CreateScreenView(String^ screenName)
{
auto data = ref new Map<String^, String^>();
data->Insert("t", HitBuilder::HitType_Screenview);
if (screenName) data->Insert("cd", screenName);
return ref new HitBuilder(data);
}
HitBuilder^ HitBuilder::CreateCustomEvent(String^ category, String^ action, String^ label, long long value)
{
auto data = ref new Map<String^, String^>();

Просмотреть файл

@ -54,12 +54,17 @@ namespace GoogleAnalytics
property int ProductCount;
property int PromotionCount;
/// <summary>
/// Creates a screen view hit.
/// </summary>
static HitBuilder^ CreateScreenView();
/// <summary>
/// Creates a screen view hit.
/// </summary>
/// <param name="screenName">Specifies the 'Screen Name' of the screenview hit. Note: this will not affect subsequent hits. To do this, set the ScreenName property on the Tracker instead.</param>
static HitBuilder^ CreateScreenView(Platform::String^ screenName);
/// <summary>
/// Creates an event hit to track events.

Просмотреть файл

@ -30,7 +30,7 @@ Tracker::Tracker(String^ propertyId, IPlatformInfoProvider^ platformInfoProvider
ViewportSize = platformInfoProvider->ViewPortResolution;
viewPortResolutionChangedEventToken = platformInfoProvider->ViewPortResolutionChanged += ref new EventHandler<Object^>(this, &Tracker::platformTrackingInfo_ViewPortResolutionChanged);
screenResolutionChangedEventToken = platformInfoProvider->ScreenResolutionChanged += ref new EventHandler<Object^>(this, &Tracker::platformTrackingInfo_ScreenResolutionChanged);
}
}
}
void Tracker::platformTrackingInfo_ViewPortResolutionChanged(Object^ sender, Object^ args)