Skip to content

Commit f22c7b9

Browse files
randyribackclaude
andcommitted
Demo: add sandbox buttons for trackConversion smoke testing
Adds two buttons on the First tab — "Track Pageview (sandbox)" and "Track Conversion (sandbox)" — that fire against the `sandbox.joshhanson.io` apikey on a shared test URL. The pageview lets a session accrue history before the conversion fires so the conversions topology has something to attribute to. Used during the manual end-to-end verification of trackConversion: with Proxyman attached, confirm action=conversion and the _conversion_type / _conversion_label keys land in the on-wire payload, then watch dash.parsely.com for the conversion in the conversions report. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent f087cbd commit f22c7b9

2 files changed

Lines changed: 46 additions & 0 deletions

File tree

Demo/ParselyDemo/Base.lproj/Main.storyboard

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,26 @@
6666
<action selector="didPauseVideo:" destination="9pv-A4-QxB" eventType="primaryActionTriggered" id="TbX-BH-W7q"/>
6767
</connections>
6868
</button>
69+
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Sandbox" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="rrx-sb-lbl">
70+
<rect key="frame" x="0.0" y="226" width="125" height="20"/>
71+
<fontDescription key="fontDescription" type="system" pointSize="17"/>
72+
<nil key="textColor"/>
73+
<nil key="highlightedColor"/>
74+
</label>
75+
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="rrx-sb-pgv">
76+
<rect key="frame" x="0.0" y="251" width="125" height="30"/>
77+
<state key="normal" title="Track Pageview (sandbox)"/>
78+
<connections>
79+
<action selector="didTouchSandboxPageview:" destination="9pv-A4-QxB" eventType="primaryActionTriggered" id="rrx-sb-pv1"/>
80+
</connections>
81+
</button>
82+
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="rrx-sb-cnv">
83+
<rect key="frame" x="0.0" y="286" width="125" height="30"/>
84+
<state key="normal" title="Track Conversion v2 (sandbox)"/>
85+
<connections>
86+
<action selector="didTouchSandboxConversion:" destination="9pv-A4-QxB" eventType="primaryActionTriggered" id="rrx-sb-cn1"/>
87+
</connections>
88+
</button>
6989
</subviews>
7090
</stackView>
7191
</subviews>

Demo/ParselyDemo/FirstViewController.swift

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,38 @@ import ParselyAnalytics
55
class FirstViewController: UIViewController {
66
let delegate = UIApplication.shared.delegate as! AppDelegate
77

8+
// Sandbox test URL for the conversion-tracking smoke flow. Both the pageview and
9+
// the conversion buttons fire against this URL on the `sandbox.joshhanson.io` apikey
10+
// so pageview history and conversion events share a visitor session in the backend.
11+
private let sandboxUrl = "https://sandbox.joshhanson.io/path/test-conversion2"
12+
private let sandboxSiteId = "sandbox.joshhanson.io"
13+
814
@IBAction func didTouchButton(_ sender: Any) {
915
log("didTouchButton")
1016
let demoMetas = ParselyMetadata(authors: ["Yogi Berr"])
1117
delegate.parsely.trackPageView(url: "http://parsely.com/path/cool-blog-post/1?qsarg=nawp&anotherone=yup", metadata: demoMetas, extraData: ["product-id": "12345"], siteId: "subdomain.parsely-test.com")
1218
}
1319

20+
@IBAction func didTouchSandboxPageview(_ sender: Any) {
21+
log("didTouchSandboxPageview")
22+
delegate.parsely.trackPageView(
23+
url: sandboxUrl,
24+
extraData: ["source": "ios_demo_app"],
25+
siteId: sandboxSiteId
26+
)
27+
}
28+
29+
@IBAction func didTouchSandboxConversion(_ sender: Any) {
30+
log("didTouchSandboxConversion")
31+
delegate.parsely.trackConversion(
32+
url: sandboxUrl,
33+
conversionType: .subscription,
34+
conversionLabel: "ios_smoke_test_v2",
35+
extraData: ["plan": "weekly", "source": "ios_demo_app"],
36+
siteId: sandboxSiteId
37+
)
38+
}
39+
1440
@IBAction func didStartEngagement(_ sender: Any) {
1541
log("didStartEngagement")
1642
delegate.parsely.startEngagement(url: "http://parsely.com/very-not-real", urlref: "http://parsely.com/not-real", extraData: ["product-id": "12345"], siteId: "engaged.parsely-test.com")

0 commit comments

Comments
 (0)