Merge pull request #1 from dotnet/screenview-screenname-addition
Overload to supply screenname on screenview and preserving value.
This commit is contained in:
Коммит
079faf0de6
|
@ -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)
|
||||
|
|
Загрузка…
Ссылка в новой задаче