Skip to content

Commit a76a494

Browse files
nattb8claude
andcommitted
chore(audience-sample): remove page() button from sample app (SDK-314)
The button called Track("screen_viewed") via a custom event — not a dedicated SDK Page API — and sat awkwardly alongside Init/Teardown controls. Studios can replicate the pattern from the Typed Events tab using a custom Track call. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent f2fb455 commit a76a494

3 files changed

Lines changed: 4 additions & 21 deletions

File tree

examples/audience/Assets/SampleApp/Resources/AudienceSample.uxml

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -125,11 +125,6 @@
125125
<ui:VisualElement class="actions last">
126126
<ui:Button name="btn-init" text="Init" />
127127

128-
<ui:Button name="btn-page" class="with-sig">
129-
<ui:Label class="btn-label" text="Page" />
130-
<ui:Label class="btn-sig" text="page()" />
131-
</ui:Button>
132-
133128
<ui:Button name="btn-flush" class="with-sig">
134129
<ui:Label class="btn-label" text="Flush" />
135130
<ui:Label class="btn-sig" text="flush()" />

examples/audience/Assets/SampleApp/Scripts/AudienceSample.UI.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ private static readonly (string TabId, string PanelId)[] Tabs =
5353
private TextField _publishableKey, _baseUrl, _flushInterval, _flushSize;
5454
private DropdownField _initialConsent;
5555
private Toggle _debug;
56-
private Button _btnInit, _btnPage, _btnFlush, _btnReset, _btnShutdown, _btnDeleteData;
56+
private Button _btnInit, _btnFlush, _btnReset, _btnShutdown, _btnDeleteData;
5757

5858
// ---- UXML element fields (Consent tab) ----
5959

@@ -195,7 +195,7 @@ private void BindElements()
195195
_flushInterval = Require<TextField>("flush-interval");
196196
_flushSize = Require<TextField>("flush-size");
197197
_btnInit = Require<Button>("btn-init");
198-
_btnPage = Require<Button>("btn-page");
198+
199199
_btnFlush = Require<Button>("btn-flush");
200200
_btnReset = Require<Button>("btn-reset");
201201
_btnShutdown = Require<Button>("btn-shutdown");
@@ -304,7 +304,7 @@ private void RegisterHandlers()
304304
_baseUrl.RegisterValueChangedCallback(_ => RefreshStatusBar());
305305

306306
_btnInit.clicked += OnInit;
307-
_btnPage.clicked += OnPage;
307+
308308
_btnFlush.clicked += async () => await OnFlushAsync();
309309
_btnReset.clicked += OnReset;
310310
_btnShutdown.clicked += OnShutdown;
@@ -614,7 +614,7 @@ private void RefreshConsentPills()
614614

615615
private void RefreshInitState()
616616
{
617-
foreach (var b in new[] { _btnPage, _btnFlush, _btnReset, _btnShutdown, _btnDeleteData, _btnCustomEvent, _btnIdentify, _btnIdentifyTraits })
617+
foreach (var b in new[] { _btnFlush, _btnReset, _btnShutdown, _btnDeleteData, _btnCustomEvent, _btnIdentify, _btnIdentifyTraits })
618618
b.SetEnabled(_initialised);
619619
foreach (var p in _consentPills.Values) p.SetEnabled(_initialised);
620620
foreach (var btn in _typedEventsHost.Query<Button>().ToList()) btn.SetEnabled(_initialised);

examples/audience/Assets/SampleApp/Scripts/AudienceSample.cs

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
using System.Collections.Generic;
55
using System.Threading.Tasks;
66
using UnityEngine;
7-
using UnityEngine.SceneManagement;
87
using UnityEngine.UIElements;
98

109
namespace Immutable.Audience.Samples.SampleApp
@@ -104,17 +103,6 @@ private async Task OnDeleteDataAsync()
104103

105104
// ---- SDK action handlers: telemetry ----
106105

107-
// v1 has no typed Screen API; Plan §10 specifies a custom Track call
108-
// as the studio-facing pattern for scene coverage. Demo follows that.
109-
private void OnPage() => RunAndLog("page()", () =>
110-
{
111-
GuardConsentForTrack();
112-
var screen = SceneManager.GetActiveScene().name;
113-
var props = new Dictionary<string, object> { ["path"] = screen };
114-
ImmutableAudience.Track("screen_viewed", props);
115-
return Json.Serialize(props, 2);
116-
});
117-
118106
// Prefers the typed overload for the four events with public C#
119107
// classes (Progression, Resource, Purchase, MilestoneReached); the
120108
// rest stay on the string overload. Typed validation errors are

0 commit comments

Comments
 (0)