ข้ามไปยังเนื้อหา

ไวยากรณ์เทมเพลต In-app แบบเนทีฟ

In-app แบบเนทีฟจะถูกแสดงผลโดยตรงโดย SDK ไม่มีการใช้ WebView เข้ามาเกี่ยวข้อง แทนที่จะเป็นหน้า index.html ทรัพยากร ZIP จะมีไฟล์ native-config.json ที่อธิบายข้อความในรูปแบบข้อมูลที่มีโครงสร้าง (ประเภทเลย์เอาต์, ข้อความ, สี, รูปภาพ, ปุ่ม) SDK จะอ่านไฟล์นี้และวาดวิวแบบเนทีฟที่ตรงกัน ซึ่งให้แอนิเมชันที่ราบรื่นและประสิทธิภาพที่ดีกว่าหน้าเว็บที่ฝังไว้

คู่มือนี้จะอธิบายสคีมาของ native-config.json: ฟิลด์, ประเภท และตัวอย่างสำหรับแต่ละประเภทการแสดงผล สำหรับรูปแบบที่ใช้ HTML แบบคลาสสิก โปรดดูที่ ไวยากรณ์เทมเพลต Rich media

ข้อกำหนดเบื้องต้น

Anchor link to

In-app แบบเนทีฟต้องการ:

  • iOS: SDK 7.2.0 หรือใหม่กว่า (7.2.1+ สำหรับ banner, carousel และ sheet)
  • Android: SDK 6.10.0 หรือใหม่กว่า (6.10.1+ สำหรับ banner, carousel และ sheet)

ยังไม่มีประเภทการแสดงผลทุกประเภทให้บริการบนทั้งสองแพลตฟอร์ม ตรวจสอบ การรองรับแพลตฟอร์ม ก่อนที่คุณจะใช้รูปแบบเฉพาะ

การรองรับแพลตฟอร์ม

Anchor link to
ประเภทการแสดงผล
iOS
Android
modal✅ 7.2.0+✅ 6.10.0+
fullscreen✅ 7.2.0+✅ 6.10.0+
stories✅ 7.2.0+✅ 6.10.0+
banner✅ 7.2.1+✅ 6.10.1+
carousel✅ 7.2.1+✅ 6.10.1+
sheet✅ 7.2.1+✅ 6.10.1+
video✅✅ 6.11.0+
pip✅ยังไม่มีให้บริการ
scratchcard✅ยังไม่มีให้บริการ
spinwheel✅ยังไม่มีให้บริการ

โครงสร้างเทมเพลต

Anchor link to

เทมเพลต in-app แบบเนทีฟคือไฟล์ ZIP archive เช่นเดียวกับเทมเพลต Rich Media ทั่วไป ยกเว้นว่าในรูทจะมีไฟล์ native-config.json แทนที่จะเป็น index.html:

<template>.zip
├── native-config.json ← required, layout and content
├── pushwoosh.json ← optional, localization (see below)

รูปภาพและวิดีโอที่อ้างอิงจาก native-config.json (image, poster, fallback, url บน pip/video) ต้องเป็น URL แบบ HTTPS สมบูรณ์ SDK จะโหลดข้อมูลเหล่านี้ผ่านเครือข่าย จะไม่อ่านไฟล์ในเครื่องจาก archive

config เองเป็นอ็อบเจกต์ JSON เดียว:

{ "displayType": "<type>", "<type>": { /* content block for this type */ } }

displayType จะเลือกหนึ่งในสิบรูปแบบด้านล่าง อ็อบเจกต์ภายใต้คีย์ที่ตรงกันจะเก็บเนื้อหาของรูปแบบนั้น config ที่มี displayType ที่ไม่รู้จัก, บล็อกเนื้อหาที่ขาดหายไป หรือรายการที่จำเป็นว่างเปล่า (items สำหรับ carousel/stories, segments สำหรับ spinwheel) จะไม่ถูกต้อง SDK จะข้ามการแสดงผลแทนที่จะแสดงเลย์เอาต์ที่เสียหาย

การตั้งค่าการจัดส่ง (วันที่เริ่มต้น/สิ้นสุด และ frequency capping) ไม่ได้เป็นส่วนหนึ่งของ native-config.json ซึ่งจะถูกกำหนดค่าในลักษณะเดียวกับ in-app อื่นๆ ในขั้นตอน การตั้งค่าการแสดงผล ของแคมเปญ

นอกจากนี้ Frequency capping ยังต้องการการ opt-in อย่างชัดเจนทางฝั่ง SDK เพื่อให้มีผลกับ in-app แบบเนทีฟ โปรดดูที่ การผสานรวม SDK

ค่าสีทุกค่าเป็นสตริงเลขฐานสิบหกของ CSS: #RGB, #RGBA, #RRGGBB หรือ #RRGGBBAA จำเป็นต้องมี # นำหน้าในทั้งสี่รูปแบบ

บล็อกการสร้างที่ใช้ร่วมกัน

Anchor link to

อ็อบเจกต์ขนาดเล็กเหล่านี้ถูกนำมาใช้ซ้ำในประเภทการแสดงผลหลายประเภท

ข้อความ

Anchor link to
ฟิลด์ประเภทจำเป็นคำอธิบาย
textstringใช่เนื้อหาข้อความ
colorstringใช่สีข้อความ
{ "text": "Spin for a garage perk", "color": "#FFFFFFFF" }

เส้นขอบ

Anchor link to
ฟิลด์ประเภทจำเป็นคำอธิบาย
colorstringใช่สีเส้นขอบ
radiusnumberใช่รัศมีมุม, เป็นพอยต์
{ "color": "#0E72E5FF", "radius": 12 }

หน้าปก

Anchor link to

รูปภาพเสริมบนสีพื้นหลัง ใช้โดย fullscreen และ scratchcard

ฟิลด์ประเภทจำเป็นคำอธิบาย
imagestringไม่URL รูปภาพหน้าปก
backgroundstringใช่สีพื้นหลังที่แสดงใต้ (หรือแทน) รูปภาพ
{ "image": "https://example.com/cover.jpg", "background": "#1A1A1EFF" }

การกระทำ

Anchor link to

discriminated union บน type:

รูปแบบฟิลด์คำอธิบาย
{ "type": "close" }ไม่มีปิด in-app
{ "type": "url", "url": string }url จำเป็นเปิด URL หรือ deep link
{ "type": "url", "url": "pushwoosh://sale" }

ปุ่ม

Anchor link to
ฟิลด์ประเภทจำเป็นคำอธิบาย
textTextใช่ป้ายกำกับปุ่ม
backgroundstringใช่สีเติมปุ่ม
borderBorderใช่เส้นขอบปุ่ม
actionActionใช่การกระทำที่เกิดขึ้นเมื่อแตะ

spinButton (spinwheel) และ revealButton (scratchcard) ใช้รูปทรงเดียวกัน โดยไม่มี action พฤติกรรมของมัน (หมุนวงล้อ, เปิดการ์ด) ถูกสร้างไว้ในตัวแล้ว

{
"text": { "text": "Book a test drive", "color": "#FFFFFFFF" },
"background": "#0E72E5FF",
"border": { "color": "#0E72E5FF", "radius": 12 },
"action": { "type": "url", "url": "pushwoosh://sale" }
}

รางวัล

Anchor link to

แผงรางวัลที่แสดงโดย scratchcard และ spinwheel รางวัลที่ถูกต้องจะต้องมี title หรือ code

ฟิลด์ประเภทจำเป็นคำอธิบาย
titleTextไม่หัวข้อรางวัล
messageTextไม่คำอธิบายรางวัล
codestringไม่รหัสโปรโมชัน, แสดงผลพร้อมปุ่มคัดลอก
buttonButtonไม่ปุ่มยืนยันพร้อมการกระทำของตัวเอง
{
"title": { "text": "20% off detailing", "color": "#111111FF" },
"message": { "text": "Valid for any full-detail booking this month.", "color": "#555555FF" },
"code": "APEX20",
"button": {
"text": { "text": "Book detailing", "color": "#FFFFFFFF" },
"background": "#B3227CFF",
"border": { "color": "#B3227CFF", "radius": 12 },
"action": { "type": "url", "url": "pushwoosh://detailing" }
}
}

ประเภทการแสดงผล

Anchor link to

แถบขนาดกะทัดรัดที่ยึดติดกับขอบบนหรือขอบล่างของหน้าจอ

ฟิลด์ประเภทจำเป็นคำอธิบาย
showClosebooleanใช่แสดงปุ่มปิด (✕)
positiontop | bottomใช่ขอบหน้าจอ
backgroundstringใช่สีพื้นหลังของแถบ
imagestringไม่ภาพขนาดย่อทางด้านซ้าย
titleTextไม่หัวข้อบรรทัดเดียว, ถูกตัดด้วยเครื่องหมายจุดไข่ปลา
messageTextไม่ข้อความเนื้อหา, สูงสุด 2 บรรทัด
actionActionใช่เกิดขึ้นเมื่อแตะที่แถบเอง
autoDismissnumberไม่ปิดอัตโนมัติหลังจากผ่านไปหลายวินาที ละเว้นเพื่อคงไว้จนกว่าจะปิด
{
"displayType": "banner",
"banner": {
"showClose": true,
"position": "bottom",
"background": "#4B5057FF",
"image": "https://example.com/thumb.jpg",
"title": { "text": "Alpine A110 just dropped", "color": "#FFFFFFFF" },
"message": { "text": "The featherweight icon — tap to see the build", "color": "#FFFFFFFF" },
"action": { "type": "url", "url": "pushwoosh://product/x6f" },
"autoDismiss": 6
}
}

ชุดการ์ดแบบเต็มหน้าจอที่สามารถปัดได้พร้อมจุดแสดงหน้า

ฟิลด์ประเภทจำเป็นคำอธิบาย
showClosebooleanใช่แสดงปุ่มปิด (✕)
itemsItem[]ใช่การ์ด (อย่างน้อย 1 ใบ)

รายการ Carousel:

ฟิลด์ประเภทจำเป็นคำอธิบาย
titleTextไม่หัวข้อการ์ด
messageTextไม่หัวข้อย่อยการ์ด
imagestringไม่รูปภาพการ์ด
actionActionไม่เกิดขึ้นเมื่อแตะที่การ์ด
{
"displayType": "carousel",
"carousel": {
"showClose": true,
"items": [
{
"image": "https://example.com/card-1.jpg",
"title": { "text": "AMG GT R", "color": "#FFFFFFFF" },
"message": { "text": "585 hp biturbo V8 — just landed", "color": "#FFFFFFFF" },
"action": { "type": "url", "url": "pushwoosh://product/n6fx" }
},
{
"image": "https://example.com/card-2.jpg",
"title": { "text": "Alpine A110", "color": "#FFFFFFFF" },
"message": { "text": "Featherweight icon — limited allocation", "color": "#FFFFFFFF" },
"action": { "type": "url", "url": "pushwoosh://product/x6f" }
}
]
}
}

fullscreen

Anchor link to

รูปภาพหน้าปกแบบขอบชนขอบพร้อมข้อความและปุ่มด้านบน

ฟิลด์ประเภทจำเป็นคำอธิบาย
showClosebooleanใช่แสดงปุ่มปิด (✕)
coverCoverใช่รูปภาพพื้นหลังและสี
titleTextไม่หัวข้อ
messageTextไม่ข้อความเนื้อหา
buttonsButton[]ใช่ปุ่มที่ด้านล่าง (สามารถเว้นว่างได้)
{
"displayType": "fullscreen",
"fullscreen": {
"showClose": true,
"cover": { "image": "https://example.com/hero.jpg", "background": "#1A1A1EFF" },
"title": { "text": "Pure Maranello", "color": "#FFFFFFFF" },
"message": { "text": "The prancing horse, reimagined.", "color": "#EBEBEBFF" },
"buttons": [
{
"text": { "text": "Reserve now", "color": "#FFFFFFFF" },
"background": "#0E72E5FF",
"border": { "color": "#0E72E5FF", "radius": 8 },
"action": { "type": "url", "url": "pushwoosh://sale" }
},
{
"text": { "text": "Not now", "color": "#FFFFFFFF" },
"background": "#00000000",
"border": { "color": "#FFFFFF99", "radius": 8 },
"action": { "type": "close" }
}
]
}
}

การ์ดที่อยู่ตรงกลาง

ฟิลด์ประเภทจำเป็นคำอธิบาย
showClosebooleanใช่แสดงปุ่มปิด (✕)
dimBackgroundbooleanใช่หรี่แสงหน้าจอด้านหลังการ์ด
backgroundstringใช่สีพื้นหลังการ์ด
imagestringไม่รูปภาพหน้าปก
titleTextไม่หัวข้อ
messageTextไม่ข้อความเนื้อหา
buttonsButton[]ใช่ปุ่มใต้ข้อความ (สามารถเว้นว่างได้)
{
"displayType": "modal",
"modal": {
"showClose": true,
"dimBackground": true,
"background": "#FFFFFFFF",
"image": "https://example.com/cover.jpg",
"title": { "text": "The GT R has landed", "color": "#4B5057FF" },
"message": { "text": "585 hp — now in the showroom.", "color": "#4B5057FF" },
"buttons": [
{
"text": { "text": "Book a test drive", "color": "#FFFFFFFF" },
"background": "#0E72E5FF",
"border": { "color": "#0E72E5FF", "radius": 12 },
"action": { "type": "url", "url": "pushwoosh://sale" }
},
{
"text": { "text": "Not now", "color": "#4B5057FF" },
"background": "#FFFFFFFF",
"border": { "color": "#4B5057FF", "radius": 12 },
"action": { "type": "close" }
}
]
}
}

หน้าต่างวิดีโอ picture-in-picture แบบลอยที่ยึดติดกับมุมหน้าจอ

ฟิลด์ประเภทจำเป็นคำอธิบาย
showClosebooleanใช่แสดงปุ่มปิด (✕)
positionbottom-right | bottom-left | top-right | top-leftใช่มุมหน้าจอ
loopbooleanใช่เล่นวนซ้ำ
mutedbooleanใช่เริ่มแบบปิดเสียง
urlstringใช่URL วิดีโอ
posterstringไม่โปสเตอร์ที่แสดงก่อนเริ่มเล่น
fallbackstringไม่รูปภาพที่แสดงหากวิดีโอเล่นไม่สำเร็จ
widthnumberใช่ความกว้างของหน้าต่างเป็นเปอร์เซ็นต์ของความกว้างหน้าจอ, จำกัดที่ 15–70
aspectRationumberใช่อัตราส่วนความสูงต่อความกว้างของหน้าต่าง
borderRadiusnumberไม่รัศมีมุมหน้าต่าง, เป็นพอยต์
actionActionไม่เกิดขึ้นเมื่อแตะที่หน้าต่างเอง

ไม่มีปุ่มที่สามารถกำหนดค่าได้บน pip การควบคุมหน้าต่าง (ขยายเต็มหน้าจอ, ปิดเสียง, ปิด) เป็นสิ่งที่ระบบจัดหาให้

{
"displayType": "pip",
"pip": {
"showClose": true,
"position": "bottom-right",
"loop": true,
"muted": true,
"url": "https://example.com/teaser.mp4",
"poster": "https://example.com/poster.jpg",
"width": 40,
"aspectRatio": 0.5625,
"action": { "type": "url", "url": "pushwoosh://product/x6f" }
}
}

scratchcard

Anchor link to

การ์ดที่มีรางวัลซ่อนอยู่ใต้ชั้นฟอยล์ที่สามารถขูดได้

ฟิลด์ประเภทจำเป็นคำอธิบาย
showClosebooleanใช่แสดงปุ่มปิด (✕)
backgroundstring | string[]ใช่สีพื้นหลังการ์ด, หรือจุดหยุดการไล่ระดับสี
revealThresholdnumberใช่ส่วนของฟอยล์ที่ต้องขูดออก (0–1) ก่อนที่รางวัลจะปรากฏ
coverCoverใช่ชั้นฟอยล์ หากไม่มี image จะมีคำใบ้ “ขูดที่นี่” แสดงบนสีพื้นหลัง
revealButtonButton (no action)ไม่ปุ่ม “เปิดเผยทันที”
titleTextไม่หัวข้อ
messageTextไม่ข้อความเนื้อหา
rewardRewardใช่รางวัลที่ซ่อนอยู่ใต้ฟอยล์
{
"displayType": "scratchcard",
"scratchcard": {
"showClose": true,
"background": ["#3A1C71FF", "#B3227CFF", "#E0503AFF"],
"revealThreshold": 0.55,
"cover": { "background": "#C9CDD6FF" },
"revealButton": {
"text": { "text": "Reveal without scratching", "color": "#3A1C71FF" },
"background": "#F2DFF5FF",
"border": { "color": "#F2DFF5FF", "radius": 10 }
},
"title": { "text": "Your loyalty reward", "color": "#FFFFFFFF" },
"message": { "text": "Scratch the foil to reveal this week's garage perk.", "color": "#F2DFF5FF" },
"reward": {
"title": { "text": "20% off detailing", "color": "#111111FF" },
"message": { "text": "Valid for any full-detail booking this month.", "color": "#555555FF" },
"code": "APEX20",
"button": {
"text": { "text": "Book detailing", "color": "#FFFFFFFF" },
"background": "#B3227CFF",
"border": { "color": "#B3227CFF", "radius": 12 },
"action": { "type": "url", "url": "pushwoosh://detailing" }
}
}
}
}

การ์ดที่ปักหมุดไว้ที่ขอบด้านล่าง, พร้อมที่จับสำหรับลาก

ฟิลด์ประเภทจำเป็นคำอธิบาย
showClosebooleanใช่แสดงปุ่มปิด (✕)
dimBackgroundbooleanใช่หรี่แสงหน้าจอด้านหลังชีต
backgroundstringใช่สีพื้นหลังชีต
imagestringไม่รูปภาพหน้าปก
titleTextไม่หัวข้อ
messageTextไม่ข้อความเนื้อหา
buttonsButton[]ใช่ปุ่มใต้ข้อความ (สามารถเว้นว่างได้)
{
"displayType": "sheet",
"sheet": {
"showClose": true,
"dimBackground": true,
"background": "#FFFFFFFF",
"image": "https://example.com/cover.jpg",
"title": { "text": "Your quote is ready", "color": "#000000FF" },
"message": { "text": "Guaranteed buyout for your A110: $68,500.", "color": "#000000FF" },
"buttons": [
{
"text": { "text": "Get guaranteed quote", "color": "#FFFFFFFF" },
"background": "#0E72E5FF",
"border": { "color": "#0E72E5FF", "radius": 12 },
"action": { "type": "url", "url": "pushwoosh://sale" }
}
]
}
}

วงล้อเสี่ยงโชคพร้อมส่วนต่างๆ ที่มีน้ำหนักและปุ่มดุมกลาง

ฟิลด์ประเภทจำเป็นคำอธิบาย
showClosebooleanใช่แสดงปุ่มปิด (✕)
backgroundstring | string[]ใช่สีพื้นหลังการ์ด, หรือจุดหยุดการไล่ระดับสี
winIndexnumberใช่ดัชนี (เริ่มต้นที่ 0) ของส่วนที่ชนะ
spinButtonButton (no action)ใช่ปุ่มดุมกลาง
titleTextไม่หัวข้อ
messageTextไม่ข้อความเนื้อหา
rewardRewardใช่รางวัลสำหรับการหมุนที่ชนะ (สำรองสำหรับส่วนที่ไม่มีรางวัลของตัวเอง)
loseTitleTextไม่หัวข้อที่แสดงเมื่อแพ้
segmentsSegment[]ใช่ส่วนของวงล้อ (SDK คาดว่าจะมี 2–12 ส่วน)

ส่วน:

ฟิลด์ประเภทจำเป็นคำอธิบาย
messageTextใช่ป้ายกำกับส่วน
colorstringไม่สีของส่วน ละเว้นเพื่อใช้พาเลทสีสำรองที่ใช้รอบวงล้อ
weightnumberใช่ขนาดส่วนสัมพัทธ์
rewardRewardไม่รางวัลเฉพาะส่วน
{
"displayType": "spinwheel",
"spinwheel": {
"showClose": true,
"background": ["#1B1B46FF", "#5B2B8FFF", "#B0338AFF"],
"winIndex": 1,
"spinButton": {
"text": { "text": "SPIN", "color": "#1B1B46FF" },
"background": "#F2C94CFF",
"border": { "color": "#D9A02BFF", "radius": 36 }
},
"title": { "text": "Spin for a garage perk", "color": "#FFFFFFFF" },
"message": { "text": "One spin — every slice wins this week.", "color": "#E3D9F2FF" },
"reward": {
"title": { "text": "You won a garage perk!", "color": "#FFFFFFFF" },
"code": "APEXPERK",
"button": {
"text": { "text": "Claim", "color": "#FFFFFFFF" },
"background": "#5B2B8FFF",
"border": { "color": "#5B2B8FFF", "radius": 12 },
"action": { "type": "close" }
}
},
"segments": [
{ "message": { "text": "5% off", "color": "#FFFFFFFF" }, "color": "#5856D6FF", "weight": 1 },
{
"message": { "text": "20% off", "color": "#FFFFFFFF" },
"color": "#30B0C7FF",
"weight": 1,
"reward": {
"title": { "text": "20% off your next service", "color": "#FFFFFFFF" },
"code": "SPIN20",
"button": {
"text": { "text": "Claim service deal", "color": "#FFFFFFFF" },
"background": "#30B0C7FF",
"border": { "color": "#30B0C7FF", "radius": 12 },
"action": { "type": "url", "url": "pushwoosh://service" }
}
}
},
{ "message": { "text": "Free wash", "color": "#FFFFFFFF" }, "color": "#FF2D55FF", "weight": 1 }
]
}
}

สไลด์เต็มหน้าจอพร้อมแถบความคืบหน้าที่ด้านบน, คล้ายกับสตอรี่ในโซเชียลมีเดีย

ฟิลด์ประเภทจำเป็นคำอธิบาย
showClosebooleanใช่แสดงปุ่มปิด (✕)
loopbooleanใช่เริ่มใหม่จากสไลด์แรกหลังจากสไลด์สุดท้าย
itemsItem[]ใช่สไลด์ (อย่างน้อย 1 สไลด์)

รายการ Stories:

ฟิลด์ประเภทจำเป็นคำอธิบาย
titleTextไม่หัวข้อ
messageTextไม่หัวข้อย่อย
imagestringไม่รูปภาพพื้นหลังสไลด์
buttonsButton[]ใช่ปุ่ม CTA ที่ด้านล่าง (สามารถเว้นว่างได้)
durationnumberใช่ระยะเวลาสไลด์, เป็นวินาที
{
"displayType": "stories",
"stories": {
"showClose": true,
"loop": false,
"items": [
{
"image": "https://example.com/slide-1.jpg",
"title": { "text": "AMG GT R", "color": "#FFFFFFFF" },
"message": { "text": "The Green Hell special", "color": "#FFFFFFFF" },
"buttons": [
{
"text": { "text": "Configure yours", "color": "#FFFFFFFF" },
"background": "#0F0F0FFF",
"border": { "color": "#0F0F0FFF", "radius": 26 },
"action": { "type": "url", "url": "pushwoosh://product/n6fx" }
}
],
"duration": 4
},
{
"image": "https://example.com/slide-2.jpg",
"title": { "text": "Alpine A110", "color": "#FFFFFFFF" },
"message": { "text": "The featherweight legend, reborn", "color": "#FFFFFFFF" },
"buttons": [],
"duration": 4
}
]
}
}

วิดีโอเต็มหน้าจอพร้อมข้อความและปุ่มด้านบน

ฟิลด์ประเภทจำเป็นคำอธิบาย
showClosebooleanใช่แสดงปุ่มปิด (✕)
loopbooleanใช่เล่นวนซ้ำ
mutedbooleanใช่เริ่มแบบปิดเสียง
urlstringใช่URL วิดีโอ (HLS หรือ MP4)
posterstringไม่โปสเตอร์ที่แสดงก่อนเริ่มเล่น
fallbackstringไม่รูปภาพที่แสดงหากวิดีโอเล่นไม่สำเร็จ
titleTextไม่หัวข้อ
messageTextไม่ข้อความเนื้อหา
buttonsButton[]ใช่ปุ่ม CTA ที่ด้านล่าง (สามารถเว้นว่างได้)
{
"displayType": "video",
"video": {
"showClose": true,
"loop": true,
"muted": true,
"url": "https://example.com/reveal.mp4",
"poster": "https://example.com/poster.jpg",
"title": { "text": "The reveal", "color": "#FFFFFFFF" },
"message": { "text": "Watch it move before anyone else.", "color": "#EBEBEBFF" },
"buttons": [
{
"text": { "text": "Shop the lineup", "color": "#FFFFFFFF" },
"background": "#0E72E5FF",
"border": { "color": "#0E72E5FF", "radius": 14 },
"action": { "type": "url", "url": "pushwoosh://sale" }
}
]
}
}

การแปลเป็นภาษาท้องถิ่น

Anchor link to

In-app แบบเนทีฟใช้กลไกการแปลเป็นภาษาท้องถิ่นแบบเดียวกับ HTML Rich Media: ค่าสตริงใน native-config.json สามารถมีตัวยึดตำแหน่ง {{key|type|default}} และคำแปลจะอยู่ในไฟล์ pushwoosh.json ที่อยู่ถัดไป ในรูปแบบเดียวกับที่อธิบายไว้ใน การเพิ่ม pushwoosh.json ตัวยึดตำแหน่งสามารถปรากฏในฟิลด์สตริงใดก็ได้, ในทุกระดับความลึก (หัวข้อ, ป้ายกำกับปุ่ม, URL รูปภาพ, URL การกระทำ)

เนื้อหาแบบไดนามิก

Anchor link to

ฟิลด์ข้อความ — title, message, text ของปุ่ม, reward.title/reward.message และ message ของรายการ/ส่วน — ยังยอมรับ เนื้อหาแบบไดนามิก และ ไวยากรณ์ Liquid ด้วย: ตัวย่อ {Tag|modifier|default} และแท็ก Liquid {% %}/{{ }} เดียวกันที่ใช้ในเนื้อหา push และอีเมล Pushwoosh จะแก้ไขสิ่งเหล่านี้ต่อผู้รับก่อนที่ข้อความจะถูกส่ง, ในลักษณะเดียวกับที่ทำสำหรับ push และอีเมล

เมื่อสร้างเทมเพลตใน ตัวแก้ไข in-app แบบเนทีฟ ของ Control Panel โทเค็นที่แทรกจะแสดงเป็นชิปในการแสดงตัวอย่างสด และ บันทึก จะถูกบล็อกหาก Liquid ของฟิลด์ข้อความไม่สามารถแยกวิเคราะห์ได้

การผสานรวม SDK

Anchor link to

เมื่อคุณเพิ่มโมดูล SDK in-app แบบเนทีฟลงในแอปของคุณ, ข้อความจะแสดงโดยอัตโนมัติ ไม่จำเป็นต้องใช้โค้ดเพิ่มเติมเพื่อแสดงข้อความที่ถูกกระตุ้นโดย push, Customer Journey, postEvent หรือ inbox

SDK ยังเปิดเผย API ขนาดเล็กสำหรับการควบคุมด้วยตนเอง:

  • iOS: Pushwoosh.inApp (โมดูล PushwooshInApp)
  • Android: PushwooshInAppUi (โมดูล pushwoosh-inapp-ui)
ความสามารถiOSAndroid
แสดง config โดยตรง (การทดสอบ/การใช้งานด้วยตนเอง)Pushwoosh.inApp.present(config)PushwooshInAppUi.present(configJson)
สังเกตวงจรชีวิตและการคลิกdelegate (PWInAppMessageDelegate)delegate (InAppMessageDelegate)
ตรวจสอบว่ามีบางอย่างอยู่บนหน้าจอหรือไม่isPresentingisPresenting
ปิดสิ่งที่แสดงอยู่ในปัจจุบันdismiss()dismiss()
หยุดชั่วคราว / เล่นต่อการแสดงผลisPausedisPaused
บังคับใช้การจำกัด maxDisplays / cooldownsetFrequencyCapEnabled(_:)setFrequencyCapEnabled(...)

Delegate callbacks (ทั้งหมดทำงานบน main thread): shouldDisplay (ส่งคืน false เพื่อระงับข้อความหนึ่งก่อนที่จะแสดง, ตัวอย่างเช่นบนหน้าจอชำระเงิน), willPresent, didPresent, didClose และ clickedAction (ทำงานเมื่อผู้ใช้แตะการกระทำ url, ก่อนที่ URL จะเปิด)

นอกจากนี้ iOS ยังรายงาน rewardRevealed และ rewardClaimed สำหรับเทมเพลต scratchcard และ spinwheel ที่เป็นเกม

// iOS
Pushwoosh.inApp.delegate = self
Pushwoosh.inApp.setFrequencyCapEnabled(true)
// Android
PushwooshInAppUi.delegate = this
PushwooshInAppUi.setFrequencyCapEnabled(true)