Engage SDK Shopping: دستورالعمل‌های یکپارچه‌سازی فنی شخص ثالث

Google در حال ساخت یک سطح روی دستگاه است که برنامه های کاربران را بر اساس عمودی سازماندهی می کند و یک تجربه همهجانبه جدید را برای مصرف شخصی و کشف محتوای برنامه امکان پذیر می کند. این تجربه تمام صفحه به شرکای توسعه‌دهنده فرصتی می‌دهد تا بهترین محتوای غنی خود را در یک کانال اختصاصی خارج از برنامه خود به نمایش بگذارند.

این راهنما حاوی دستورالعمل‌هایی برای شرکای توسعه‌دهنده است تا محتوای خرید خود را با استفاده از Engage SDK برای پر کردن این سطح جدید و سطوح موجود Google مانند Entertainment Space، یکپارچه کنند.

جزئیات یکپارچه سازی

اصطلاحات

این ادغام شامل پنج نوع خوشه زیر است: توصیه ، ویژه ، سبد خرید ، فهرست خرید ، سفارش مجدد و پیگیری سفارش خرید .

  • خوشه‌های توصیه پیشنهادات خرید شخصی‌شده از یک شریک توسعه‌دهنده را نشان می‌دهند. این توصیه‌ها را می‌توان برای کاربر شخصی‌سازی کرد یا تعمیم داد (به عنوان مثال، موارد پرطرفدار). از این ها برای نمایش محصولات، رویدادها، فروش ها، تبلیغات، اشتراک ها به دلخواه خود استفاده کنید.

    توصیه های شما ساختار زیر را دارد:

    • Recommendation Cluster: نمای رابط کاربری که شامل گروهی از توصیه‌های یک شریک توسعه‌دهنده است.

    • ShoppingEntity: یک شی که یک مورد را در یک خوشه نشان می دهد.

  • خوشه ویژه مجموعه‌ای از موجودیت‌ها را از چندین شریک توسعه‌دهنده در یک گروه‌بندی UI به نمایش می‌گذارد. یک خوشه ویژه وجود خواهد داشت که در نزدیکی بالای رابط کاربری با اولویت بالاتر از همه خوشه‌های توصیه ظاهر می‌شود. هر شریک توسعه دهنده مجاز به پخش حداکثر 10 موجودیت در خوشه ویژه خواهد بود.

  • خوشه سبد خرید نگاهی اجمالی به سبد خرید از بسیاری از شرکای توسعه‌دهنده در یک گروه رابط کاربری نشان می‌دهد و کاربران را وادار می‌کند تا سبدهای خرید برجسته خود را تکمیل کنند. یک خوشه سبد خرید وجود دارد که در نزدیکی بالای رابط کاربری ظاهر می‌شود، با اولویت بالاتر از همه خوشه‌های توصیه. هر شریک توسعه دهنده مجاز به پخش حداکثر 3 نمونه ShoppingCart در خوشه سبد خرید است.

    سبد خرید شما ساختار زیر را دارد:

    • خوشه سبد خرید: نمای رابط کاربری که شامل گروهی از پیش نمایش های سبد خرید از بسیاری از شرکای توسعه دهنده است.

    • سبد خرید: شیئی که نمایانگر پیش‌نمایش سبد خرید برای یک شریک توسعه‌دهنده است که در خوشه سبد خرید نمایش داده می‌شود. ShoppingCart باید تعداد کل اقلام موجود در سبد را نشان دهد و همچنین ممکن است شامل تصاویر برخی از اقلام در سبد خرید کاربر باشد.

  • خوشه فهرست خرید نگاهی اجمالی به لیست های خرید از چندین شریک توسعه دهنده در یک گروه UI را نشان می دهد که از کاربران می خواهد برای به روز رسانی و تکمیل لیست های خود به برنامه مربوطه بازگردند. یک خوشه لیست خرید وجود دارد.

  • خوشه Reorder نگاهی اجمالی از سفارشات قبلی از چندین شریک توسعه دهنده در یک گروه UI را نشان می دهد که کاربران را وادار به سفارش مجدد می کند. یک خوشه Reorder واحد وجود دارد.

    • خوشه سفارش مجدد باید تعداد کل موارد در سفارش قبلی کاربر را نشان دهد و همچنین باید یکی از موارد زیر را شامل شود:

      • تصاویر برای X مورد در سفارش قبلی کاربر.
      • برچسب‌هایی برای X مورد در سفارش قبلی کاربر.
  • خوشه ردیابی سفارش خرید نگاهی گذرا از سفارشات خرید در انتظار یا اخیراً تکمیل شده از بسیاری از شرکای توسعه‌دهنده در یک گروه UI نشان می‌دهد که به کاربران امکان می‌دهد سفارش‌های خود را پیگیری کنند.

    یک خوشه ShoppingOrderTracking وجود دارد که در نزدیکی بالای UI ظاهر می‌شود، با اولویت بالاتر از همه خوشه‌های Recommendation. هر شریک توسعه دهنده مجاز است چندین مورد ShoppingOrderTrackingEntity را در خوشه ردیابی سفارش خرید پخش کند.

    • ShoppingOrderTrackingCluster شما ساختار زیر را دارد:

      • ShoppingOrderTracking Cluster : نمای رابط کاربری که شامل گروهی از پیش نمایش های ردیابی سفارش از بسیاری از شرکای توسعه دهنده است.
      • ShoppingOrderTrackingEntity : یک شی که نشان دهنده پیش نمایش ردیابی سفارش خرید برای یک شریک توسعه دهنده است که در خوشه پیگیری سفارش خرید نمایش داده می شود. ShoppingOrderTrackingEntity باید وضعیت سفارش و زمان سفارش را نشان دهد. ما قویاً توصیه می‌کنیم زمان تحویل مورد انتظار برای ShoppingOrderTrackingEntity را پر کنید، زیرا در صورت ارائه به کاربران نمایش داده می‌شود.

قبل از کار

حداقل سطح API: 19

کتابخانه com.google.android.engage:engage-core به برنامه خود اضافه کنید:

dependencies {
    // Make sure you also include that repository in your project's build.gradle file.
    implementation 'com.google.android.engage:engage-core:1.5.2'
}

برای اطلاعات بیشتر، مشاهده بسته در Android 11 را ببینید.

خلاصه

طراحی بر اساس اجرای یک سرویس محدود است.

داده‌هایی که مشتری می‌تواند منتشر کند مشمول محدودیت‌های زیر برای انواع مختلف خوشه است:

نوع خوشه محدودیت های خوشه ای حداکثر محدودیت موجودیت در یک خوشه
خوشه(های) توصیه حداکثر 7 حداکثر 50 ShoppingEntity
خوشه ویژه حداکثر 1 حداکثر 20 ShoppingEntity
خوشه سبد خرید حداکثر 1 حداکثر 3 ShoppingCart

سبدهای چندگانه فقط برای برنامه‌هایی با سبدهای جداگانه برای هر تاجر مورد انتظار است.

خوشه لیست خرید حداکثر 1 حداکثر 1 ShoppingListEntity
خوشه سفارش مجدد خرید حداکثر 1 حداکثر 1 ReorderEntity
خوشه پیگیری سفارش خرید حداکثر 3 حداکثر 3 ShoppingOrderTrackingEntity

مرحله 1: داده های موجودیت را ارائه دهید

SDK موجودیت های مختلفی را برای نشان دادن هر نوع مورد تعریف کرده است. نهادهای زیر برای دسته خرید پشتیبانی می شوند:

  1. ShoppingEntity
  2. ShoppingCart
  3. ShoppingList
  4. Reorder
  5. ShoppingOrderTracking

نمودارهای زیر ویژگی ها و الزامات موجود برای هر نوع را مشخص می کند.

ShoppingEntity

شی ShoppingEntity محصول، تبلیغ، معامله، اشتراک یا رویدادی را نشان می دهد که شرکای توسعه دهنده می خواهند منتشر کنند.

ShoppingEntity
صفت مورد نیاز توضیحات قالب
تصاویر پوستر مورد نیاز حداقل یک تصویر باید ارائه شود. برای راهنمایی به مشخصات تصویر مراجعه کنید.
اکشن اوری مورد نیاز

پیوند عمیق به صفحه در برنامه که جزئیات مربوط به موجودیت را نشان می دهد.

توجه: می توانید از پیوندهای عمیق برای ذکر منبع استفاده کنید. به این سؤالات متداول مراجعه کنید

اوری
عنوان اختیاری نام نهاد.

متن رایگان

اندازه متن توصیه شده: کمتر از 90 کاراکتر (متنی که خیلی طولانی است ممکن است بیضی نشان دهد)

قیمت - فعلی مشروط مورد نیاز است

قیمت فعلی واحد تجاری

در صورت ارائه قیمت خطی باید ارائه شود.

متن رایگان
قیمت - خط خطی اختیاری قیمت اصلی موجودیت، که در رابط کاربری ثبت شده است. متن رایگان
فراخوانی اختیاری فراخوانی برای ارائه یک تبلیغ، رویداد یا به‌روزرسانی برای نهاد، در صورت وجود.

متن رایگان

اندازه متن توصیه شده: کمتر از 45 کاراکتر (متنی که خیلی طولانی است ممکن است بیضی نشان دهد)

چاپ ریز چاپ اختیاری متن چاپ دقیق برای فراخوانی.

متن رایگان

اندازه متن توصیه شده: کمتر از 45 کاراکتر (متنی که خیلی طولانی است ممکن است بیضی نشان دهد)

رتبه بندی (اختیاری) - توجه: همه رتبه بندی ها با استفاده از سیستم رتبه بندی ستاره استاندارد ما نمایش داده می شوند.
رتبه - حداکثر مقدار اختیاری

حداکثر مقدار مقیاس رتبه بندی.

اگر ارزش فعلی رتبه‌بندی نیز ارائه شده باشد، باید ارائه شود.

عدد >= 0.0
رتبه - ارزش فعلی اختیاری

ارزش فعلی مقیاس رتبه بندی.

اگر حداکثر مقدار رتبه بندی نیز ارائه شده باشد، باید ارائه شود.

عدد >= 0.0
رتبه بندی - شمارش اختیاری

تعداد رتبه‌بندی‌ها برای نهاد.

توجه: اگر برنامه شما نحوه نمایش تعداد به کاربران را کنترل می‌کند، این قسمت را وارد کنید. از یک رشته مختصر استفاده کنید. به عنوان مثال، اگر تعداد 1,000,000 باشد، از مخفف‌هایی مانند 1M استفاده کنید تا این تعداد در اندازه‌های نمایشگر کوچک‌تر کوتاه نشود.

رشته
رتبه بندی - مقدار شمارش اختیاری

تعداد رتبه‌بندی‌ها برای نهاد.

توجه: اگر خودتان منطق مخفف نمایشگر را مدیریت نمی‌کنید، این فیلد را وارد کنید. اگر تعداد و مقدار تعداد هر دو موجود باشد، تعداد به کاربران نمایش داده می شود.

طولانی
DisplayTimeWindow (اختیاری) - یک پنجره زمانی برای نمایش محتوا روی سطح تنظیم کنید
مهر زمانی را شروع کنید اختیاری

مهر زمانی دوره که پس از آن محتوا باید روی سطح نشان داده شود.

اگر تنظیم نشود، محتوا واجد شرایط نمایش در سطح است.

مهر زمانی دوره در میلی ثانیه
پایان مهر زمان اختیاری

مهر زمانی دوره ای که پس از آن محتوا دیگر روی سطح نشان داده نمی شود.

اگر تنظیم نشود، محتوا واجد شرایط نمایش در سطح است.

مهر زمانی دوره در میلی ثانیه

ShoppingCart

صفت مورد نیاز توضیحات قالب
اکشن اوری مورد نیاز

پیوند عمیق به سبد خرید در برنامه شریک.

توجه: می توانید از پیوندهای عمیق برای ذکر منبع استفاده کنید. به این سؤالات متداول مراجعه کنید

اوری
تعداد اقلام مورد نیاز

تعداد اقلام (نه فقط تعداد محصولات) در سبد خرید.

به عنوان مثال: اگر 3 پیراهن یکسان و 1 کلاه در سبد خرید وجود دارد، این عدد باید 4 باشد.

عدد صحیح >= 1
متن اقدام اختیاری

متن تماس برای اقدام دکمه روی سبد خرید (به عنوان مثال، کیف خرید شما ).

اگر هیچ متن اقدامی توسط برنامه‌نویس ارائه نشد، View Cart پیش‌فرض است.

این ویژگی در نسخه 1.1.0 به بعد پشتیبانی می شود.

رشته
عنوان اختیاری

عنوان سبد خرید (به عنوان مثال، کیف خرید شما ).

اگر هیچ عنوانی توسط توسعه دهنده ارائه نشده باشد، سبد خرید شما پیش فرض است.

اگر شریک توسعه‌دهنده سبد خرید جداگانه‌ای برای هر تاجر منتشر می‌کند، لطفاً نام تاجر را در عنوان ذکر کنید.

متن رایگان

اندازه متن توصیه شده: کمتر از 25 کاراکتر (متنی که خیلی طولانی است ممکن است بیضی نشان دهد)

تصاویر سبد خرید اختیاری

تصاویر هر محصول در سبد خرید.

حداکثر 10 تصویر به ترتیب اولویت ارائه می شود. تعداد واقعی تصاویر نمایش داده شده به فاکتور فرم دستگاه بستگی دارد.

برای راهنمایی به مشخصات تصویر مراجعه کنید.
برچسب های اقلام اختیاری

لیست برچسب ها برای اقلام موجود در لیست خرید.

تعداد واقعی برچسب های نمایش داده شده به فاکتور فرم دستگاه بستگی دارد.

لیست برچسب های متن آزاد

اندازه متن توصیه شده: کمتر از 20 کاراکتر (متنی که خیلی طولانی است ممکن است بیضی نشان دهد)

آخرین مهر زمان تعامل کاربر اختیاری تعداد میلی‌ثانیه‌های سپری شده از دوره، مشخص می‌کند آخرین زمانی که کاربر با سبد خرید تعامل داشته است.

این به عنوان ورودی توسط شرکای توسعه‌دهنده ارسال می‌شود که سبد خرید جداگانه برای هر تاجر منتشر می‌کنند و شاید برای رتبه‌بندی استفاده شود.

مهر زمانی دوره در میلی ثانیه
DisplayTimeWindow (اختیاری) - یک پنجره زمانی برای نمایش محتوا روی سطح تنظیم کنید
مهر زمانی را شروع کنید اختیاری

مهر زمانی دوره که پس از آن محتوا باید روی سطح نشان داده شود.

اگر تنظیم نشود، محتوا واجد شرایط نمایش در سطح است.

مهر زمانی دوره در میلی ثانیه
پایان مهر زمان اختیاری

مهر زمانی دوره ای که پس از آن محتوا دیگر روی سطح نشان داده نمی شود.

اگر تنظیم نشود، محتوا واجد شرایط نمایش در سطح است.

مهر زمانی دوره در میلی ثانیه

ShoppingList

صفت مورد نیاز توضیحات قالب
اکشن اوری مورد نیاز

پیوند عمیق به لیست خرید در برنامه شریک.

توجه: می توانید از پیوندهای عمیق برای ذکر منبع استفاده کنید. به این سؤالات متداول مراجعه کنید

اوری
تعداد اقلام مورد نیاز تعداد کالاهای موجود در لیست خرید. عدد صحیح >= 1
عنوان اختیاری

عنوان لیست (به عنوان مثال، فهرست مواد غذایی شما ).

اگر هیچ عنوانی توسط توسعه دهنده ارائه نشده باشد، لیست خرید پیش فرض است.

متن رایگان

اندازه متن توصیه شده: کمتر از 25 کاراکتر (متنی که خیلی طولانی است ممکن است بیضی نشان دهد)

برچسب های اقلام مورد نیاز

لیست برچسب ها برای اقلام موجود در لیست خرید.

حداقل 1 برچسب باید ارائه شود و حداکثر 10 برچسب می تواند به ترتیب اولویت ارائه شود. تعداد واقعی برچسب های نمایش داده شده به فاکتور فرم دستگاه بستگی دارد.

لیست برچسب های متن آزاد

اندازه متن توصیه شده: کمتر از 20 کاراکتر (متنی که خیلی طولانی است ممکن است بیضی نشان دهد)

ShoppingReorderCluster

صفت مورد نیاز توضیحات قالب
اکشن اوری مورد نیاز

پیوند عمیق برای سفارش مجدد در برنامه شریک.

توجه: می توانید از پیوندهای عمیق برای ذکر منبع استفاده کنید. به این سؤالات متداول مراجعه کنید

اوری
متن اقدام اختیاری

متن فراخوانی دکمه روی ترتیب مجدد (به عنوان مثال، دوباره سفارش دهید ).

اگر هیچ متن اقدامی توسط توسعه‌دهنده ارائه نشد، Reorder پیش‌فرض است.

این ویژگی در نسخه 1.1.0 به بعد پشتیبانی می شود.

رشته
تعداد اقلام مورد نیاز

تعداد اقلام (نه فقط تعداد محصولات) در سفارش قبلی.

به عنوان مثال: اگر به ترتیب قبلی 3 قهوه کوچک و 1 کروسان وجود داشت، این عدد باید 4 باشد.

عدد صحیح >= 1
عنوان مورد نیاز عنوان مورد سفارش مجدد.

متن رایگان

اندازه متن توصیه شده: کمتر از 40 کاراکتر (متنی که خیلی طولانی است ممکن است بیضی نشان دهد)

برچسب های اقلام

اختیاری

(در صورت عدم ارائه، تصاویر پوستر ارائه شود)

لیست برچسب های اقلام برای سفارش قبلی.

حداکثر 10 برچسب می تواند به ترتیب اولویت ارائه شود. تعداد واقعی برچسب های نمایش داده شده به فاکتور فرم دستگاه بستگی دارد.

لیست متن آزاد

اندازه متن توصیه شده برای هر برچسب: کمتر از 20 کاراکتر (متنی که خیلی طولانی است ممکن است بیضی نشان دهد)

تصاویر پوستر

اختیاری

(در صورت عدم ارائه، برچسب های کالا باید ارائه شود)

تصاویری از اقلام به ترتیب قبلی.

حداکثر 10 تصویر به ترتیب اولویت ارائه می شود. تعداد واقعی تصاویر نمایش داده شده به فاکتور فرم دستگاه بستگی دارد.

برای راهنمایی به مشخصات تصویر مراجعه کنید.

ShoppingOrderTrackingCluster

صفت مورد نیاز توضیحات قالب
عنوان مورد نیاز

عنوان کوتاهی از بسته/اقلام در حال پیگیری یا شماره رهگیری.

متن رایگان

اندازه متن توصیه شده: 50 کاراکتر (متنی که خیلی طولانی باشد بیضی ها را نشان می دهد)

نوع سفارش مورد نیاز

عنوان کوتاهی از بسته/اقلام در حال پیگیری یا شماره رهگیری.

تعداد: IN_STORE_PICKUP، SAME_DAY_DELIVERY، MULTI_DAY_DELIVERY

وضعیت مورد نیاز

وضعیت فعلی سفارش

به عنوان مثال: "تأخیر اجرا می شود"، "در حال حمل و نقل"، "تاخیر"، "ارسال شده"، "تحویل شده"، "تمام موجودی"، "سفارش آماده است"

متن رایگان

اندازه متن توصیه شده: 25 کاراکتر (متنی که خیلی طولانی باشد بیضی ها را نشان می دهد)

زمان سفارش مورد نیاز

مهر زمانی دوره بر حسب میلی ثانیه که در آن سفارش ثبت شد.

اگر پنجره زمان تحویل مورد انتظار وجود نداشته باشد، زمان سفارش نمایش داده می شود

مهر زمانی دوره در میلی ثانیه
اکشن اوری مورد نیاز

پیوند عمیق به ردیابی سفارش در برنامه شریک.

اوری
OrderDeliveryTimeWindow (اختیاری) - یک پنجره زمانی برای سفارشی که از زمان ثبت سفارش تا زمان تحویل مورد انتظار/واقعی پیگیری می شود، تنظیم کنید.
OrderDeliveryTimeWindow - زمان شروع اختیاری

مهر زمانی دوره در میلی ثانیه در/پس از آن سفارش تحویل داده می شود یا برای تحویل آماده می شود.

مهر زمانی دوره در میلی ثانیه
OrderDeliveryTimeWindow - زمان پایان اختیاری

مهر زمانی دوره در میلی ثانیه در/قبل از آن سفارش تحویل داده می شود یا برای تحویل آماده می شود.

مهر زمانی دوره در میلی ثانیه
تصاویر پوستر اختیاری

تصویر یک کالا/محصول که بخشی از سفارش است.

نسبت تصویر پیشنهادی 1:1 است

برای راهنمایی به مشخصات تصویر مراجعه کنید.
تعداد اقلام اختیاری تعداد اقلام در سفارش عدد صحیح >= 1
توضیحات اختیاری

یک پاراگراف متن برای توصیف موارد به ترتیب.

توجه: توضیحات یا لیست زیرنویس برای کاربر نمایش داده می شود، نه هر دو.

متن رایگان

اندازه متن پیشنهادی: 180 کاراکتر

لیست زیرنویس اختیاری

حداکثر 3 زیرنویس، با هر زیرنویس یک خط متن.

توجه: توضیحات یا لیست زیرنویس برای کاربر نمایش داده می شود، نه هر دو.

متن رایگان

اندازه متن توصیه شده برای هر زیرنویس: حداکثر 50 کاراکتر

ارزش سفارش - CurrentPrice اختیاری ارزش فعلی سفارش متن رایگان
شماره سفارش اختیاری شماره سفارش / شناسه ای که می تواند برای شناسایی منحصر به فرد سفارش استفاده شود.

متن رایگان

اندازه متن پیشنهادی: حداکثر 25 کاراکتر

شماره پیگیری اختیاری شماره پیگیری برای سفارش/تحویل بسته در صورتی که سفارش نیاز به تحویل داشته باشد.

متن رایگان

اندازه متن پیشنهادی: حداکثر 25 کاراکتر

مشخصات تصویر

مشخصات مورد نیاز برای دارایی های تصویر در زیر ذکر شده است:

نسبت ابعاد حداقل پیکسل پیکسل های توصیه شده

مربع (1x1)

برای خوشه های غیر مشخص ترجیح داده می شود

300x300 1200x1200

منظره (1.91x1)

برای خوشه های برجسته ترجیح داده می شود

600x314 1200x628
پرتره (4x5) 480x600 960x1200

فرمت های فایل

PNG، JPG، GIF استاتیک، WebP

حداکثر اندازه فایل

5120 کیلوبایت

توصیه های اضافی

  • ناحیه امن تصویر: محتوای مهم خود را 80 درصد در مرکز تصویر قرار دهید.
  • از پس زمینه شفاف استفاده کنید تا تصویر به درستی در تنظیمات تم تیره و روشن نمایش داده شود.

مرحله 2: داده های Cluster را ارائه دهید

توصیه می‌شود کار انتشار محتوا در پس‌زمینه اجرا شود (مثلاً با استفاده از WorkManager ) و به‌طور منظم یا بر اساس رویداد برنامه‌ریزی شود (به عنوان مثال، هر بار که کاربر برنامه را باز می‌کند یا زمانی که کاربر به تازگی چیزی را به سبد خرید خود اضافه کرده است).

AppEngageShoppingClient مسئول انتشار خوشه های خرید است.

API های زیر در معرض خوشه های انتشار در مشتری قرار می گیرند:

  • isServiceAvailable
  • publishRecommendationClusters
  • publishFeaturedCluster
  • publishShoppingCart
  • publishShoppingCarts
  • publishShoppingList
  • publishShoppingReorderCluster
  • publishShoppingOrderTrackingCluster
  • publishUserAccountManagementRequest
  • updatePublishStatus
  • deleteRecommendationsClusters
  • deleteFeaturedCluster
  • deleteShoppingCartCluster
  • deleteShoppingListCluster
  • deleteShoppingReorderCluster
  • deleteShoppingOrderTrackingCluster
  • deleteUserManagementCluster
  • deleteClusters

isServiceAvailable

این API برای بررسی اینکه آیا سرویس برای یکپارچه سازی در دسترس است و اینکه آیا محتوا می تواند در دستگاه ارائه شود یا خیر استفاده می شود.

کاتلین

client.isServiceAvailable.addOnCompleteListener { task ->
    if (task.isSuccessful) {
        // Handle IPC call success
        if(task.result) {
          // Service is available on the device, proceed with content publish
          // calls.
        } else {
          // Service is not available, no further action is needed.
        }
    } else {
      // The IPC call itself fails, proceed with error handling logic here,
      // such as retry.
    }
}

جاوا

client.isServiceAvailable().addOnCompleteListener(task - > {
    if (task.isSuccessful()) {
        // Handle success
        if(task.getResult()) {
          // Service is available on the device, proceed with content
          // publish calls.
        } else {
          // Service is not available, no further action is needed.
        }
    } else {
      // The IPC call itself fails, proceed with error handling logic here,
      // such as retry.
    }
});

publishRecommendationClusters

این API برای انتشار لیستی از اشیاء RecommendationCluster استفاده می شود.

یک شی RecommendationCluster می تواند دارای ویژگی های زیر باشد:

صفت مورد نیاز توضیحات
لیست ShoppingEntity مورد نیاز فهرستی از اشیاء ShoppingEntity که توصیه‌های این کلاستر توصیه را تشکیل می‌دهند.
عنوان مورد نیاز

عنوان برای خوشه توصیه.

اندازه متن توصیه شده: کمتر از 25 کاراکتر (متنی که خیلی طولانی است ممکن است بیضی نشان دهد)

زیرنویس اختیاری زیرنویس خوشه توصیه.
اکشن اوری اختیاری

پیوند عمیق به صفحه در برنامه شریک که در آن کاربران می‌توانند فهرست کامل توصیه‌ها را ببینند.

توجه: می توانید از پیوندهای عمیق برای ذکر منبع استفاده کنید. به این سؤالات متداول مراجعه کنید

کاتلین

client.publishRecommendationClusters(
            PublishRecommendationClustersRequest.Builder()
                .addRecommendationCluster(
                    RecommendationCluster.Builder()
                        .addEntity(entity1)
                        .addEntity(entity2)
                        .setTitle("Black Friday Deals")
                        .build())
                .build())

جاوا

client.publishRecommendationClusters(
            new PublishRecommendationClustersRequest.Builder()
                .addRecommendationCluster(
                    new RecommendationCluster.Builder()
                        .addEntity(entity1)
                        .addEntity(entity2)
                        .setTitle("Black Friday Deals")
                        .build())
                .build());

هنگامی که سرویس درخواست را دریافت می کند، اقدامات زیر در یک تراکنش انجام می شود:

  • تمام داده های موجود در خوشه توصیه حذف شده است.
  • داده‌های درخواست در خوشه‌های پیشنهادی جدید تجزیه و ذخیره می‌شوند.

در صورت بروز خطا، کل درخواست رد می شود و وضعیت موجود حفظ می شود.

publishFeaturedCluster

این API برای انتشار یک شی FeaturedCluster استفاده می شود.

کاتلین

client.publishFeaturedCluster(
            PublishFeaturedClusterRequest.Builder()
                .setFeaturedCluster(
                    FeaturedCluster.Builder()
                        ...
                        .build())
                .build())

جاوا

client.publishFeaturedCluster(
            new PublishFeaturedClusterRequest.Builder()
                .setFeaturedCluster(
                    new FeaturedCluster.Builder()
                        ...
                        .build())
                .build());

هنگامی که سرویس درخواست را دریافت می کند، اقدامات زیر در یک تراکنش انجام می شود:

  • داده های FeaturedCluster موجود از شریک توسعه حذف شده است.
  • داده های درخواست تجزیه و تحلیل می شود و در خوشه ویژه به روز شده ذخیره می شود.

در صورت بروز خطا، کل درخواست رد می شود و وضعیت موجود حفظ می شود.

publishShoppingCart

این API برای انتشار یک شی ShoppingCartCluster استفاده می شود.

کاتلین

client.publishShoppingCart(
            PublishShoppingCartRequest.Builder()
                .setShoppingCart(
                    ShoppingCart.Builder()
                        ...
                        .build())
                .build())

جاوا

client.publishShoppingCart(
            new PublishShoppingCartRequest.Builder()
                .setShoppingCart(
                    new ShoppingCart.Builder()
                        ...
                        .build())
                .build())

هنگامی که سرویس درخواست را دریافت می کند، اقدامات زیر در یک تراکنش انجام می شود:

  • داده‌های ShoppingCart موجود از شریک توسعه‌دهنده حذف شده است.
  • داده های درخواست تجزیه و تحلیل می شود و در خوشه سبد خرید به روز شده ذخیره می شود.

در صورت بروز خطا، کل درخواست رد می شود و وضعیت موجود حفظ می شود.

publishShoppingCarts

این API برای انتشار چندین شیء ShoppingCart استفاده می شود. این برای شریک توسعه‌دهنده که سبدهای خرید جداگانه را برای هر تاجر منتشر می‌کند، اعمال می‌شود. هنگام استفاده از این API، نام تاجر را در عنوان وارد کنید.

کاتلین

client.publishShoppingCarts(
            PublishShoppingCartClustersRequest.Builder()
                .addShoppingCart(
                    ShoppingCart.Builder()
                        ...
                        .build())
                .build())

جاوا

client.publishShoppingCarts(
            new PublishShoppingCartClustersRequest.Builder()
                .addShoppingCart(
                    new ShoppingCart.Builder()
                        ...
                        .build())
                .build())

هنگامی که سرویس درخواست را دریافت می کند، اقدامات زیر در یک تراکنش انجام می شود:

  • داده‌های ShoppingCart موجود از شریک توسعه‌دهنده حذف شده است.
  • داده های درخواست تجزیه و تحلیل می شود و در خوشه سبد خرید به روز شده ذخیره می شود.

در صورت بروز خطا، کل درخواست رد می شود و وضعیت موجود حفظ می شود.

publishShoppingList

این API برای انتشار یک شی FoodShoppingList استفاده می شود.

کاتلین

client.publishFoodShoppingList(
            PublishFoodShoppingListRequest.Builder()
                .setFoodShoppingList(
                    FoodShoppingListEntity.Builder()
                        ...
                        .build())
                .build())

جاوا

client.publishFoodShoppingList(
            new PublishFoodShoppingListRequest.Builder()
                .setFoodShoppingList(
                    new FoodShoppingListEntity.Builder()
                        ...
                        .build())
                .build());

هنگامی که سرویس درخواست را دریافت می کند، اقدامات زیر در یک تراکنش انجام می شود:

  • داده های FoodShoppingList موجود از شریک سازنده حذف شده است.
  • داده های درخواست تجزیه و تحلیل می شود و در خوشه لیست خرید به روز شده ذخیره می شود.

در صورت بروز خطا، کل درخواست رد می شود و وضعیت موجود حفظ می شود.

publishShoppingReorderCluster

این API برای انتشار یک شی ShoppingReorderCluster استفاده می شود.

کاتلین

client.publishShoppingReorderCluster(
            PublishShoppingReorderClusterRequest.Builder()
                .setReorderCluster(
                    ShoppingReorderCluster.Builder()
                        ...
                        .build())
                .build())

جاوا

client.publishShoppingReorderCluster(
            new PublishShoppingReorderClusterRequest.Builder()
                .setReorderCluster(
                    new ShoppingReorderCluster.Builder()
                        ...
                        .build())
                .build());

هنگامی که سرویس درخواست را دریافت می کند، اقدامات زیر در یک تراکنش انجام می شود:

  • داده های موجود ShoppingReorderCluster از شریک توسعه دهنده حذف شده است.
  • داده‌های درخواست تجزیه و تحلیل می‌شوند و در خوشه ترتیب مجدد به‌روز شده ذخیره می‌شوند.

در صورت بروز خطا، کل درخواست رد می شود و وضعیت موجود حفظ می شود.

publishShoppingOrderTrackingCluster

این API برای انتشار یک شی ShoppingOrderTrackingCluster استفاده می شود.

کاتلین

client.publishShoppingOrderTrackingCluster(
            PublishShoppingOrderTrackingClusterRequest.Builder()
                .setShoppingOrderTrackingCluster(
                    ShoppingOrderTrackingCluster.Builder()
                        ...
                        .build())
                .build())

جاوا

client.publishShoppingOrderTrackingCluster(
            new PublishShoppingOrderTrackingClusterRequest.Builder()
                .setShoppingOrderTrackingCluster(
                    new ShoppingOrderTrackingCluster.Builder()
                        ...
                        .build())
                .build());

هنگامی که سرویس درخواست را دریافت می کند، اقدامات زیر در یک تراکنش انجام می شود:

  • داده های موجود ShoppingOrderTrackingCluster از شریک توسعه دهنده حذف شده است.
  • داده‌های درخواست در خوشه پیگیری سفارش خرید به‌روز شده تجزیه و ذخیره می‌شوند.

در صورت بروز خطا، کل درخواست رد می شود و وضعیت موجود حفظ می شود.

publishUserAccountManagementRequest

این API برای انتشار کارت ورود به سیستم استفاده می شود. عمل ورود به سیستم، کاربران را به صفحه ورود به برنامه هدایت می‌کند تا برنامه بتواند محتوا را منتشر کند (یا محتوای شخصی‌سازی‌شده‌تری ارائه کند)

فراداده زیر بخشی از کارت ورود به سیستم است -

صفت مورد نیاز توضیحات
اکشن اوری مورد نیاز پیوند عمیق به Action (یعنی به صفحه ورود به برنامه پیمایش می‌کند)
تصویر اختیاری - در صورت عدم ارائه، عنوان باید ارائه شود

تصویر روی کارت نشان داده شده است

تصاویر با نسبت ابعاد 16x9 با وضوح 1264x712

عنوان اختیاری - اگر ارائه نشد، تصویر باید ارائه شود عنوان روی کارت
متن اقدام اختیاری متن نمایش داده شده در CTA (یعنی ورود به سیستم)
زیرنویس اختیاری زیرنویس اختیاری روی کارت

کاتلین

var SIGN_IN_CARD_ENTITY =
      SignInCardEntity.Builder()
          .addPosterImage(
              Image.Builder()
                  .setImageUri(Uri.parse("http://www.x.com/image.png"))
                  .setImageHeightInPixel(500)
                  .setImageWidthInPixel(500)
                  .build())
          .setActionText("Sign In")
          .setActionUri(Uri.parse("http://xx.com/signin"))
          .build()

client.publishUserAccountManagementRequest(
            PublishUserAccountManagementRequest.Builder()
                .setSignInCardEntity(SIGN_IN_CARD_ENTITY)
                .build());

جاوا

SignInCardEntity SIGN_IN_CARD_ENTITY =
      new SignInCardEntity.Builder()
          .addPosterImage(
              new Image.Builder()
                  .setImageUri(Uri.parse("http://www.x.com/image.png"))
                  .setImageHeightInPixel(500)
                  .setImageWidthInPixel(500)
                  .build())
          .setActionText("Sign In")
          .setActionUri(Uri.parse("http://xx.com/signin"))
          .build();

client.publishUserAccountManagementRequest(
            new PublishUserAccountManagementRequest.Builder()
                .setSignInCardEntity(SIGN_IN_CARD_ENTITY)
                .build());

هنگامی که سرویس درخواست را دریافت می کند، اقدامات زیر در یک تراکنش انجام می شود:

  • داده های موجود UserAccountManagementCluster از شریک توسعه دهنده حذف شده است.
  • داده های درخواست در خوشه UserAccountManagementCluster به روز شده تجزیه و ذخیره می شود.

در صورت بروز خطا، کل درخواست رد می شود و وضعیت موجود حفظ می شود.

updatePublishStatus

اگر به دلایل تجاری داخلی، هیچ یک از خوشه‌ها منتشر نشد، اکیداً توصیه می‌کنیم وضعیت انتشار را با استفاده از updatePublishStatus API به‌روزرسانی کنید. این مهم است زیرا:

  • ارائه وضعیت در همه سناریوها، حتی زمانی که محتوا منتشر می شود (وضعیت == منتشر شده)، برای پر کردن داشبوردهایی که از این وضعیت صریح برای انتقال سلامت و سایر معیارهای ادغام شما استفاده می کنند، بسیار مهم است.
  • اگر محتوایی منتشر نشود اما وضعیت ادغام خراب نباشد (STATUS == NOT_PUBLISHED)، Google می‌تواند از ایجاد هشدار در داشبوردهای سلامت برنامه جلوگیری کند. تأیید می کند که محتوا به دلیل یک وضعیت مورد انتظار از دیدگاه ارائه دهنده منتشر نمی شود.
  • این به توسعه‌دهندگان کمک می‌کند تا بینش‌هایی درباره زمانی که داده‌ها منتشر می‌شوند در مقابل عدم انتشار اطلاعات ارائه کنند.
  • ممکن است Google از کدهای وضعیت استفاده کند تا کاربر را وادار کند تا اقدامات خاصی را در برنامه انجام دهد تا بتواند محتوای برنامه را ببیند یا بر آن غلبه کند.

لیست کدهای وضعیت انتشار واجد شرایط عبارتند از:

// Content is published
AppEngagePublishStatusCode.PUBLISHED,

// Content is not published as user is not signed in
AppEngagePublishStatusCode.NOT_PUBLISHED_REQUIRES_SIGN_IN,

// Content is not published as user is not subscribed
AppEngagePublishStatusCode.NOT_PUBLISHED_REQUIRES_SUBSCRIPTION,

// Content is not published as user location is ineligible
AppEngagePublishStatusCode.NOT_PUBLISHED_INELIGIBLE_LOCATION,

// Content is not published as there is no eligible content
AppEngagePublishStatusCode.NOT_PUBLISHED_NO_ELIGIBLE_CONTENT,

// Content is not published as the feature is disabled by the client
// Available in v1.3.1
AppEngagePublishStatusCode.NOT_PUBLISHED_FEATURE_DISABLED_BY_CLIENT,

// Content is not published as the feature due to a client error
// Available in v1.3.1
AppEngagePublishStatusCode.NOT_PUBLISHED_CLIENT_ERROR,

// Content is not published as the feature due to a service error
// Available in v1.3.1
AppEngagePublishStatusCode.NOT_PUBLISHED_SERVICE_ERROR,

// Content is not published due to some other reason
// Reach out to engage-developers@ before using this enum.
AppEngagePublishStatusCode.NOT_PUBLISHED_OTHER

اگر محتوا به دلیل وارد نشدن کاربر منتشر نشود، Google انتشار کارت ورود به سیستم را توصیه می کند. اگر به هر دلیلی ارائه دهندگان قادر به انتشار کارت ورود به سیستم نیستند، توصیه می کنیم با کد وضعیت NOT_PUBLISHED_REQUIRES_SIGN_IN با updatePublishStatus API تماس بگیرید.

کاتلین

client.updatePublishStatus(
   PublishStatusRequest.Builder()
     .setStatusCode(AppEngagePublishStatusCode.NOT_PUBLISHED_REQUIRES_SIGN_IN)
     .build())

جاوا

client.updatePublishStatus(
    new PublishStatusRequest.Builder()
        .setStatusCode(AppEngagePublishStatusCode.NOT_PUBLISHED_REQUIRES_SIGN_IN)
        .build());

deleteRecommendationClusters

این API برای حذف محتوای خوشه های توصیه استفاده می شود.

کاتلین

client.deleteRecommendationClusters()

جاوا

client.deleteRecommendationClusters();

هنگامی که سرویس درخواست را دریافت می کند، داده های موجود را از خوشه های توصیه حذف می کند. در صورت بروز خطا، کل درخواست رد می شود و وضعیت موجود حفظ می شود.

deleteFeaturedCluster

این API برای حذف محتوای Featured Cluster استفاده می شود.

کاتلین

client.deleteFeaturedCluster()

جاوا

client.deleteFeaturedCluster();

هنگامی که سرویس درخواست را دریافت می کند، داده های موجود را از خوشه ویژه حذف می کند. در صورت بروز خطا، کل درخواست رد می شود و وضعیت موجود حفظ می شود.

deleteShoppingCartCluster

این API برای حذف محتوای خوشه سبد خرید استفاده می شود.

کاتلین

client.deleteShoppingCartCluster()

جاوا

client.deleteShoppingCartCluster();

هنگامی که سرویس درخواست را دریافت می کند، داده های موجود را از خوشه سبد خرید حذف می کند. در صورت بروز خطا، کل درخواست رد می شود و وضعیت موجود حفظ می شود.

deleteShoppingListCluster

این API برای حذف محتوای خوشه لیست خرید استفاده می شود.

کاتلین

client.deleteShoppingListCluster()

جاوا

client.deleteShoppingListCluster();

هنگامی که سرویس درخواست را دریافت می کند، داده های موجود را از خوشه لیست خرید حذف می کند. در صورت بروز خطا، کل درخواست رد می شود و وضعیت موجود حفظ می شود.

deleteShoppingReorderCluster

این API برای حذف محتوای Shopping Reorder Cluster استفاده می شود.

کاتلین

client.deleteShoppingReorderCluster()

جاوا

client.deleteShoppingReorderCluster();

هنگامی که سرویس درخواست را دریافت می کند، داده های موجود را از خوشه سفارش مجدد خرید حذف می کند. در صورت بروز خطا، کل درخواست رد می شود و وضعیت موجود حفظ می شود.

deleteShoppingOrderTrackingCluster

این API برای حذف محتوای خوشه ردیابی سفارش خرید استفاده می شود.

کاتلین

client.deleteShoppingOrderTrackingCluster()

جاوا

client.deleteShoppingOrderTrackingCluster();

هنگامی که سرویس درخواست را دریافت می کند، داده های موجود را از خوشه پیگیری سفارش خرید حذف می کند. در صورت بروز خطا، کل درخواست رد می شود و وضعیت موجود حفظ می شود.

deleteUserManagementCluster

این API برای حذف محتوای UserAccountManagement Cluster استفاده می شود.

کاتلین

client.deleteUserManagementCluster()

جاوا

client.deleteUserManagementCluster();

هنگامی که سرویس درخواست را دریافت می کند، داده های موجود را از UserAccountManagement Cluster حذف می کند. در صورت بروز خطا، کل درخواست رد می شود و وضعیت موجود حفظ می شود.

deleteClusters

این API برای حذف محتوای یک نوع خوشه مشخص استفاده می شود.

کاتلین

client.deleteClusters(
    DeleteClustersRequest.Builder()
      .addClusterType(ClusterType.TYPE_FEATURED)
      .addClusterType(ClusterType.TYPE_RECOMMENDATION)
      ...
      .build())

جاوا

client.deleteClusters(
            new DeleteClustersRequest.Builder()
                .addClusterType(ClusterType.TYPE_FEATURED)
                .addClusterType(ClusterType.TYPE_RECOMMENDATION)
                ...
                .build());

هنگامی که سرویس درخواست را دریافت می کند، داده های موجود را از همه خوشه های مطابق با انواع خوشه های مشخص شده حذف می کند. مشتریان می توانند انتخاب کنند که یک یا چند نوع خوشه را پاس کنند. در صورت بروز خطا، کل درخواست رد می شود و وضعیت موجود حفظ می شود.

رسیدگی به خطا

به شدت توصیه می شود که به نتیجه کار از API های منتشر شده گوش دهید تا بتوان یک اقدام بعدی را برای بازیابی و ارسال مجدد یک کار موفق انجام داد.

کاتلین

client.publishRecommendationClusters(
        PublishRecommendationClustersRequest.Builder()
          .addRecommendationCluster(..)
          .build())
      .addOnCompleteListener { task ->
        if (task.isSuccessful) {
          // do something
        } else {
          val exception = task.exception
          if (exception is AppEngageException) {
            @AppEngageErrorCode val errorCode = exception.errorCode
            if (errorCode == AppEngageErrorCode.SERVICE_NOT_FOUND) {
              // do something
            }
          }
        }
      }

جاوا

client.publishRecommendationClusters(
              new PublishRecommendationClustersRequest.Builder()
                  .addRecommendationCluster(...)
                  .build())
          .addOnCompleteListener(
              task -> {
                if (task.isSuccessful()) {
                  // do something
                } else {
                  Exception exception = task.getException();
                  if (exception instanceof AppEngageException) {
                    @AppEngageErrorCode
                    int errorCode = ((AppEngageException) exception).getErrorCode();
                    if (errorCode == AppEngageErrorCode.SERVICE_NOT_FOUND) {
                      // do something
                    }
                  }
                }
              });

خطا به عنوان AppEngageException با علت به عنوان کد خطا برگردانده می شود.

کد خطا نام خطا توجه داشته باشید
1 SERVICE_NOT_FOUND این سرویس در دستگاه داده شده در دسترس نیست.
2 SERVICE_NOT_AVAILABLE این سرویس در دستگاه داده شده در دسترس است، اما در زمان تماس در دسترس نیست (مثلاً صراحتاً غیرفعال است).
3 SERVICE_CALL_EXECUTION_FAILURE اجرای کار به دلیل مشکلات رشته ای انجام نشد. در این صورت می توان آن را دوباره امتحان کرد.
4 SERVICE_CALL_PERMISSION_DENIED تماس گیرنده مجاز به برقراری تماس سرویس نیست.
5 SERVICE_CALL_INVALID_ARGUMENT درخواست حاوی داده های نامعتبر است (به عنوان مثال، بیش از تعداد مجاز خوشه ها).
6 SERVICE_CALL_INTERNAL خطایی در سمت سرویس وجود دارد.
7 SERVICE_CALL_RESOURCE_EXHAUSTED تماس سرویس خیلی مکرر برقرار می شود.

مرحله 3: اهداف پخش را مدیریت کنید

علاوه بر برقراری تماس‌های API محتوای انتشار از طریق یک کار، برای دریافت درخواست انتشار محتوا نیز باید یک BroadcastReceiver راه‌اندازی کرد.

هدف از اهداف پخش عمدتاً فعال سازی مجدد برنامه و همگام سازی اجباری داده ها است. اهداف پخش برای ارسال خیلی مکرر طراحی نشده اند. تنها زمانی فعال می‌شود که سرویس Engage تشخیص دهد که ممکن است محتوا قدیمی باشد (مثلاً یک هفته‌ای است). به این ترتیب، اطمینان بیشتری وجود دارد که کاربر می تواند یک تجربه محتوای تازه داشته باشد، حتی اگر برنامه برای مدت طولانی اجرا نشده باشد.

BroadcastReceiver باید به دو روش زیر راه اندازی شود:

  • به صورت پویا یک نمونه از کلاس BroadcastReceiver را با استفاده از Context.registerReceiver() ثبت کنید. این امکان برقراری ارتباط از برنامه هایی را که هنوز در حافظه هستند را امکان پذیر می کند.

کاتلین

class AppEngageBroadcastReceiver : BroadcastReceiver(){
  // Trigger recommendation cluster publish when PUBLISH_RECOMMENDATION
  // broadcast is received
  // Trigger featured cluster publish when PUBLISH_FEATURED broadcast is
  // received
  // Trigger shopping cart cluster publish when PUBLISH_SHOPPING_CART broadcast
  // is received
  // Trigger shopping list cluster publish when PUBLISH_SHOPPING_LIST broadcast
  // is received
  // Trigger reorder cluster publish when PUBLISH_REORDER_CLUSTER broadcast is
  // received
  // Trigger shopping order tracking cluster publish when
  // PUBLISH_SHOPPING_ORDER_TRACKING_CLUSTER broadcast is received
}

fun registerBroadcastReceivers(context: Context){
  var  context = context
  context = context.applicationContext

// Register Recommendation Cluster Publish Intent
  context.registerReceiver(AppEngageBroadcastReceiver(),
                           IntentFilter(Intents.ACTION_PUBLISH_RECOMMENDATION))

// Register Featured Cluster Publish Intent
  context.registerReceiver(AppEngageBroadcastReceiver(),
                           IntentFilter(Intents.ACTION_PUBLISH_FEATURED))

// Register Shopping Cart Cluster Publish Intent
  context.registerReceiver(AppEngageBroadcastReceiver(),
                           IntentFilter(Intents.ACTION_PUBLISH_SHOPPING_CART))

// Register Shopping List Cluster Publish Intent
  context.registerReceiver(AppEngageBroadcastReceiver(),
                           IntentFilter(Intents.ACTION_PUBLISH_SHOPPING_LIST))

// Register Reorder Cluster Publish Intent
  context.registerReceiver(AppEngageBroadcastReceiver(),
                           IntentFilter(Intents.ACTION_PUBLISH_REORDER_CLUSTER))

// Register Shopping Order Tracking Cluster Publish Intent
  context.registerReceiver(AppEngageBroadcastReceiver(),
                           IntentFilter(Intents.ACTION_PUBLISH_SHOPPING_ORDER_TRACKING_CLUSTER))
}

جاوا

class AppEngageBroadcastReceiver extends BroadcastReceiver {
// Trigger recommendation cluster publish when PUBLISH_RECOMMENDATION broadcast
// is received

// Trigger featured cluster publish when PUBLISH_FEATURED broadcast is received

// Trigger shopping cart cluster publish when PUBLISH_SHOPPING_CART broadcast is
// received

// Trigger shopping list cluster publish when PUBLISH_SHOPPING_LIST broadcast is
// received

// Trigger reorder cluster publish when PUBLISH_REORDER_CLUSTER broadcast is
// received

// Trigger reorder cluster publish when PUBLISH_SHOPPING_ORDER_TRACKING_CLUSTER
// broadcast is received
}

public static void registerBroadcastReceivers(Context context) {

context = context.getApplicationContext();

// Register Recommendation Cluster Publish Intent
context.registerReceiver(new AppEngageBroadcastReceiver(),
new IntentFilter(com.google.android.engage.service.Intents.ACTION_PUBLISH_RECOMMENDATION));

// Register Featured Cluster Publish Intent
context.registerReceiver(new AppEngageBroadcastReceiver(),
new IntentFilter(com.google.android.engage.service.Intents.ACTION_PUBLISH_FEATURED));

// Register Shopping Cart Cluster Publish Intent
context.registerReceiver(new AppEngageBroadcastReceiver(),
new IntentFilter(com.google.android.engage.shopping.service.Intents.ACTION_PUBLISH_SHOPPING_CART));

// Register Shopping List Cluster Publish Intent
context.registerReceiver(new AppEngageBroadcastReceiver(),
new IntentFilter(com.google.android.engage.shopping.service.Intents.ACTION_PUBLISH_SHOPPING_LIST));

// Register Reorder Cluster Publish Intent
context.registerReceiver(new AppEngageBroadcastReceiver(),
new IntentFilter(com.google.android.engage.shopping.service.Intents.ACTION_PUBLISH_REORDER_CLUSTER));

// Register Shopping Order Tracking Cluster Publish Intent
context.registerReceiver(new AppEngageBroadcastReceiver(),
new IntentFilter(com.google.android.engage.shopping.service.Intents.ACTION_PUBLISH_SHOPPING_ORDER_TRACKING_CLUSTER));

}
  • به صورت ایستا یک پیاده سازی را با تگ <receiver> در فایل AndroidManifest.xml خود اعلام کنید. این اجازه می دهد تا برنامه زمانی که در حال اجرا نیست، اهداف پخش را دریافت کند و همچنین به برنامه اجازه می دهد محتوا را منتشر کند.
<application>
   <receiver
      android:name=".AppEngageBroadcastReceiver"
      android:exported="true"
      android:enabled="true">
      <intent-filter>
         <action android:name="com.google.android.engage.action.PUBLISH_RECOMMENDATION" />
      </intent-filter>
      <intent-filter>
         <action android:name="com.google.android.engage.action.PUBLISH_FEATURED" />
      </intent-filter>
      <intent-filter>
         <action android:name="com.google.android.engage.action.shopping.PUBLISH_SHOPPING_CART" />
      </intent-filter>
      <intent-filter>
         <action android:name="com.google.android.engage.action.shopping.PUBLISH_SHOPPING_LIST" />
      </intent-filter>
      <intent-filter>
         <action android:name="com.google.android.engage.action.shopping.PUBLISH_REORDER_CLUSTER" />
      </intent-filter>
      <intent-filter>
         <action android:name="com.google.android.engage.action.shopping.PUBLISH_SHOPPING_ORDER_TRACKING_CLUSTER" />
      </intent-filter>
   </receiver>
</application>

اهداف زیر توسط سرویس ارسال می شود:

  • com.google.android.engage.action.PUBLISH_RECOMMENDATION توصیه می شود هنگامی که این هدف دریافت شد، یک تماس publishRecommendationClusters شروع شود.
  • com.google.android.engage.action.PUBLISH_FEATURED توصیه می شود هنگامی که این هدف دریافت شد، یک تماس publishFeaturedCluster شروع شود.
  • com.google.android.engage.action.shopping.PUBLISH_SHOPPING_CART توصیه می شود هنگامی که این هدف دریافت شد، تماس publishShoppingCart را شروع کنید.
  • com.google.android.engage.action.shopping.PUBLISH_SHOPPING_LIST توصیه می شود هنگامی که این هدف دریافت شد، یک تماس publishShoppingList شروع کنید.
  • com.google.android.engage.action.shopping.PUBLISH_REORDER_CLUSTER توصیه می شود هنگامی که این هدف دریافت شد، یک تماس publishReorderCluster شروع شود.
  • com.google.android.engage.action.shopping.PUBLISH_SHOPPING_ORDER_TRACKING_CLUSTER توصیه می شود هنگامی که این هدف دریافت شد، یک تماس publishShoppingOrderTrackingCluster شروع کنید.

گردش کار یکپارچه سازی

برای راهنمایی گام به گام در مورد تأیید ادغام خود پس از تکمیل، به گردش کار ادغام برنامه‌نویس Engage مراجعه کنید.

سوالات متداول

برای پرسش‌های متداول به پرسش‌های متداول SDK مراجعه کنید.

تماس بگیرید

در صورت وجود هرگونه سوال در طول فرآیند ادغام، با engage-developers@google.com تماس بگیرید. تیم ما در اسرع وقت پاسخ می دهد.

مراحل بعدی

پس از تکمیل این ادغام، مراحل بعدی شما به شرح زیر است:

  • یک ایمیل به engage-developers@google.com ارسال کنید و APK یکپارچه خود را که برای آزمایش توسط Google آماده است، پیوست کنید.
  • Google یک راستی‌آزمایی را انجام می‌دهد و به صورت داخلی بررسی می‌کند تا مطمئن شود ادغام مطابق انتظار عمل می‌کند. در صورت نیاز به تغییرات، Google با هر گونه جزئیات لازم با شما تماس می گیرد.
  • وقتی آزمایش کامل شد و نیازی به تغییر نیست، Google با شما تماس می گیرد تا به شما اطلاع دهد که می توانید شروع به انتشار APK به روز شده و یکپارچه در فروشگاه Play کنید.
  • پس از اینکه Google تأیید کرد که APK به‌روزرسانی‌شده شما در فروشگاه Play منتشر شده است، توصیه‌ها ، ویژگی‌ها ، سبد خرید ، فهرست خرید ، خوشه‌های سفارش مجدد و خوشه‌های پیگیری سفارش خرید ممکن است منتشر شده و برای کاربران قابل مشاهده باشند.
،

Google در حال ساخت یک سطح روی دستگاه است که برنامه های کاربران را بر اساس عمودی سازماندهی می کند و یک تجربه همهجانبه جدید را برای مصرف شخصی و کشف محتوای برنامه امکان پذیر می کند. این تجربه تمام صفحه به شرکای توسعه‌دهنده فرصتی می‌دهد تا بهترین محتوای غنی خود را در یک کانال اختصاصی خارج از برنامه خود به نمایش بگذارند.

این راهنما شامل دستورالعمل هایی برای شرکای توسعه دهنده برای ادغام محتوای خرید خود ، با استفاده از SDK Engage برای جمع آوری هم در سطح جدید و هم سطوح گوگل موجود مانند فضای سرگرمی است.

جزئیات ادغام

اصطلاحات

این ادغام شامل پنج نوع خوشه زیر است: توصیه ، برجسته ، سبد خرید ، لیست خرید ، ردیابی سفارش و سفارش خرید .

  • خوشه های توصیه پیشنهادات خرید شخصی را از یک شریک توسعه دهنده خاص نشان می دهند. این توصیه ها را می توان برای کاربر شخصی سازی کرد یا تعمیم داد (به عنوان مثال موارد روند). از این موارد برای محصولات سطحی ، رویدادها ، فروش ، تبلیغات ، اشتراک ها به عنوان مناسب استفاده کنید.

    توصیه های شما ساختار زیر را می گیرد:

    • خوشه توصیه: نمای UI که شامل گروهی از توصیه ها از همان شریک توسعه دهنده است.

    • خرید: یک شیء که یک مورد واحد را در یک خوشه نشان می دهد.

  • این خوشه های برجسته مجموعه ای از اشخاص را از چندین شرکای توسعه دهنده در یک گروه بندی UI نشان می دهد. یک خوشه برجسته وجود خواهد داشت که در نزدیکی بالای UI با قرار دادن اولویت بالاتر از همه خوشه های توصیه قرار می گیرد. به هر شریک توسعه دهنده اجازه پخش تا 10 نهاد در خوشه برجسته داده می شود.

  • خوشه سبد خرید ، نگاهی دزدکی از سبد خرید از بسیاری از شرکای توسعه دهنده در یک گروه بندی UI نشان می دهد و کاربران را برای تکمیل چرخ دستی های برجسته خود فریب می دهد. یک خوشه سبد خرید واحد وجود دارد که در نزدیکی بالای UI قرار دارد و دارای اولویت بالاتر از همه خوشه های توصیه است. هر شریک توسعه دهنده مجاز به پخش 3 نمونه ShoppingCart در خوشه سبد خرید است.

    سبد خرید شما ساختار زیر را می گیرد:

    • خوشه سبد خرید: نمای UI که شامل گروهی از پیش نمایش های سبد خرید از بسیاری از شرکای توسعه دهنده است.

    • ShoppingCart: یک شیء به نمایندگی از پیش نمایش سبد خرید برای یک شریک توسعه دهنده واحد ، در خوشه سبد خرید نمایش داده می شود. جعبه ShoppingCart باید تعداد کل موارد موجود در سبد خرید را نشان دهد و همچنین ممکن است شامل برخی از موارد موجود در سبد کاربر باشد.

  • خوشه لیست خرید ، نگاهی جالب از لیست های خرید از چندین شرکای توسعه دهنده در یک گروه UI نشان می دهد و باعث می شود کاربران برای به روزرسانی و تکمیل لیست های خود به برنامه مربوطه برگردند. یک خوشه لیست خرید واحد وجود دارد.

  • خوشه نوری نگاهی دزدکی از سفارشات قبلی از چندین شرکای توسعه دهنده در یک گروه بندی UI نشان می دهد و باعث می شود کاربران دوباره مرتب شوند. یک خوشه تنظیم مجدد وجود دارد.

    • خوشه مجدد باید تعداد کل موارد را در سفارش قبلی کاربر نشان دهد و همچنین باید یکی از موارد زیر را شامل شود:

      • تصاویر برای موارد X در سفارش قبلی کاربر.
      • برچسب های مربوط به موارد X در سفارش قبلی کاربر.
  • خوشه ردیابی سفارش خرید ، نگاهی دزدکی از سفارشات خرید در انتظار یا اخیراً تکمیل شده از بسیاری از شرکای توسعه دهنده در یک گروه UI نشان می دهد و به کاربران امکان می دهد سفارشات خود را ردیابی کنند.

    یک خوشه منفرد خرید وجود دارد که در نزدیکی بالای UI قرار دارد و دارای اولویت بالاتر از همه خوشه های توصیه است. به هر شریک توسعه دهنده اجازه داده می شود چندین مورد خرید و فروش را در خوشه ردیابی سفارش خرید پخش کند.

    • شما ساختار زیر را می گیرد:

      • خوشه خرید و فروش : نمای UI که شامل گروهی از پیش نمایش های ردیابی سفارش از بسیاری از شرکای توسعه دهنده است
      • ShoppordorDortrackingEntity : یک شیء که نمایانگر پیش نمایش سفارش خرید برای یک شریک توسعه دهنده واحد است ، در خوشه ردیابی سفارش خرید نمایش داده می شود. خرید و فروش باید وضعیت سفارش و زمان سفارش را نشان دهد. ما اکیداً توصیه می کنیم زمان تحویل مورد انتظار را برای خرید و فروشر برای خرید ، همانطور که در صورت ارائه به کاربران نمایش داده می شود ، جمع کنید.

پیش کار

حداقل سطح API: 19

com.google.android.engage:engage-core به برنامه خود اضافه کنید:

dependencies {
    // Make sure you also include that repository in your project's build.gradle file.
    implementation 'com.google.android.engage:engage-core:1.5.2'
}

برای اطلاعات بیشتر ، به دید بسته در Android 11 مراجعه کنید.

خلاصه

این طرح مبتنی بر اجرای یک سرویس محدود است.

داده هایی که مشتری می تواند منتشر کند برای انواع مختلف خوشه ای در معرض محدودیت های زیر است:

نوع خوشه محدودیت های خوشه حداکثر محدودیت موجودیت در یک خوشه
خوشه توصیه (های) حداکثر 7 حداکثر 50 ShoppingEntity
خوشه برجسته حداکثر 1 حداکثر 20 ShoppingEntity
خوشه سبد خرید حداکثر 1 حداکثر 3 ShoppingCart

چرخ دستی های متعدد فقط برای برنامه هایی با چرخ دستی جداگانه برای هر بازرگان پیش بینی می شود.

خوشه لیست خرید حداکثر 1 حداکثر 1 ShoppingListEntity
خوشه تغییرگر خرید حداکثر 1 حداکثر 1 ReorderEntity
خوشه ردیابی سفارش خرید حداکثر 3 حداکثر 3 ShoppingOrderTrackingEntity

مرحله 1: داده های موجودیت را ارائه دهید

SDK اشخاص مختلفی را برای نشان دادن هر نوع مورد تعریف کرده است. نهادهای زیر برای دسته خرید پشتیبانی می شوند:

  1. ShoppingEntity
  2. ShoppingCart
  3. ShoppingList
  4. Reorder
  5. ShoppingOrderTracking

نمودارهای زیر صفات و الزامات موجود برای هر نوع را ترسیم می کند.

ShoppingEntity

شیء ShoppingEntity نمایانگر یک محصول ، تبلیغ ، معامله ، اشتراک یا رویدادی است که شرکای توسعه دهنده می خواهند منتشر کنند.

ShoppingEntity
صفت مورد نیاز توضیحات قالب
تصاویر پوستر مورد نیاز حداقل یک تصویر باید ارائه شود. برای راهنمایی به مشخصات تصویر مراجعه کنید.
عمل مورد نیاز

پیوند عمیق به صفحه در برنامه که جزئیات مربوط به موجودیت را نشان می دهد.

توجه: می توانید از پیوندهای عمیق برای انتساب استفاده کنید. به این سؤالات متداول مراجعه کنید

اوری
عنوان اختیاری نام موجودیت.

متن رایگان

اندازه متن توصیه شده: زیر 90 کاراکتر (متن خیلی طولانی ممکن است بیضی نشان دهد)

قیمت - فعلی به طور مشروط مورد نیاز است

قیمت فعلی نهاد.

در صورت ارائه قیمت Strikethrough باید ارائه شود.

متن رایگان
قیمت - Strikethrough اختیاری قیمت اصلی این نهاد ، که در UI از بین می رود. متن رایگان
فراخوانی اختیاری در صورت وجود فراخوانی برای ارائه یک تبلیغ ، رویداد یا به روزرسانی برای موجودیت.

متن رایگان

اندازه متن توصیه شده: زیر 45 کاراکتر (متن خیلی طولانی ممکن است بیضی نشان دهد)

چاپ خوب تماس اختیاری متن چاپ خوب برای فراخوانی.

متن رایگان

اندازه متن توصیه شده: زیر 45 کاراکتر (متن خیلی طولانی ممکن است بیضی نشان دهد)

رتبه بندی (اختیاری) - توجه: همه رتبه بندی ها با استفاده از سیستم رتبه بندی استاندارد ستاره ما نمایش داده می شوند.
رتبه بندی - مقدار حداکثر اختیاری

حداکثر مقدار مقیاس رتبه بندی.

اگر مقدار فعلی رتبه بندی نیز ارائه شود ، باید ارائه شود.

شماره> = 0.0
رتبه بندی - مقدار فعلی اختیاری

مقدار فعلی مقیاس رتبه بندی.

اگر حداکثر ارزش رتبه بندی نیز ارائه شود ، باید ارائه شود.

شماره> = 0.0
رتبه بندی - شمارش اختیاری

تعداد رتبه بندی های موجود برای نهاد.

توجه: اگر برنامه شما نحوه نمایش شمارش را به کاربران کنترل می کند ، این قسمت را ارائه دهید. از یک رشته مختصر استفاده کنید. به عنوان مثال ، اگر تعداد آنها 1،000،000 است ، استفاده از مخفف مانند 1M را در نظر بگیرید تا تعداد در اندازه های صفحه نمایش کوچکتر کوتاه نشود.

رشته
رتبه بندی - مقدار شمارش اختیاری

تعداد رتبه بندی های موجود برای نهاد.

توجه: اگر خودتان منطق مخفف نمایش را اداره نمی کنید ، این قسمت را ارائه دهید. اگر مقدار شمارش و تعداد تعداد وجود داشته باشد ، تعداد برای کاربران نمایش داده می شود.

طولانی
DisplayTimeWindow (اختیاری) - یک پنجره زمانی را تنظیم کنید تا یک محتوا روی سطح نشان داده شود
Timestamp را شروع کنید اختیاری

Timestamp Epoch پس از آن محتوا باید روی سطح نشان داده شود.

در صورت عدم تنظیم ، محتوا واجد شرایط نشان داده شده در سطح است.

زمان سنجی دوره در میلی ثانیه
پایان زمان سنج اختیاری

Timestamp Epoch پس از آن محتوا دیگر روی سطح نشان داده نمی شود.

در صورت عدم تنظیم ، محتوا واجد شرایط نشان داده شده در سطح است.

زمان سنجی دوره در میلی ثانیه

ShoppingCart

صفت مورد نیاز توضیحات قالب
عمل مورد نیاز

پیوند عمیق به سبد خرید در برنامه شریک زندگی.

توجه: می توانید از پیوندهای عمیق برای انتساب استفاده کنید. به این سؤالات متداول مراجعه کنید

اوری
تعداد اقلام مورد نیاز

تعداد موارد (نه فقط تعداد محصولات) در سبد خرید.

به عنوان مثال: اگر 3 پیراهن یکسان و 1 کلاه در سبد خرید وجود داشته باشد ، این شماره باید 4 باشد.

عدد صحیح> = 1
متن عمل اختیاری

متن تماس با دکمه دکمه روی سبد خرید (به عنوان مثال ، کیف خرید شما ).

اگر هیچ متن اکشن توسط توسعه دهنده ارائه نشده باشد ، مشاهده سبد خرید به طور پیش فرض است.

این ویژگی در نسخه 1.1.0 به بعد پشتیبانی می شود.

رشته
عنوان اختیاری

عنوان سبد خرید (به عنوان مثال ، کیف خرید شما ).

اگر هیچ عنوانی توسط توسعه دهنده ارائه نشده باشد ، سبد خرید شما پیش فرض است.

اگر شریک توسعه دهنده یک سبد جداگانه برای هر بازرگان منتشر می کند ، لطفاً نام بازرگان را در عنوان درج کنید.

متن رایگان

اندازه متن توصیه شده: زیر 25 کاراکتر (متن خیلی طولانی ممکن است بیضی نشان دهد)

تصاویر سبد خرید اختیاری

تصاویر هر محصول در سبد خرید.

حداکثر 10 تصویر به ترتیب اولویت ارائه می شود. تعداد واقعی تصاویر نمایش داده شده به ضریب فرم دستگاه بستگی دارد.

برای راهنمایی به مشخصات تصویر مراجعه کنید.
برچسب های موردی اختیاری

لیست برچسب های مربوط به موارد موجود در لیست خرید.

تعداد واقعی برچسب های نمایش داده شده به ضریب فرم دستگاه بستگی دارد.

لیست برچسب های متن رایگان

اندازه متن توصیه شده: زیر 20 کاراکتر (متن خیلی طولانی ممکن است بیضی نشان دهد)

آخرین زمان تعامل کاربر اختیاری تعداد میلی ثانیه از دوره خارج شده و آخرین باری که کاربر با سبد خرید تعامل دارد ، مشخص می شود.

این به عنوان ورودی توسط شرکای توسعه دهنده که سبد خرید جداگانه برای هر بازرگان را منتشر می کنند ، منتقل می شود و شاید برای رتبه بندی استفاده شود.

زمان سنجی دوره در میلی ثانیه
DisplayTimeWindow (اختیاری) - یک پنجره زمانی را تنظیم کنید تا یک محتوا روی سطح نشان داده شود
Timestamp را شروع کنید اختیاری

Timestamp Epoch پس از آن محتوا باید روی سطح نشان داده شود.

در صورت عدم تنظیم ، محتوا واجد شرایط نشان داده شده در سطح است.

زمان سنجی دوره در میلی ثانیه
پایان زمان سنج اختیاری

Timestamp Epoch پس از آن محتوا دیگر روی سطح نشان داده نمی شود.

در صورت عدم تنظیم ، محتوا واجد شرایط نشان داده شده در سطح است.

زمان سنجی دوره در میلی ثانیه

ShoppingList

صفت مورد نیاز توضیحات قالب
عمل مورد نیاز

پیوند عمیق به لیست خرید در برنامه شریک زندگی.

توجه: می توانید از پیوندهای عمیق برای انتساب استفاده کنید. به این سؤالات متداول مراجعه کنید

اوری
تعداد اقلام مورد نیاز تعداد موارد موجود در لیست خرید. عدد صحیح> = 1
عنوان اختیاری

عنوان لیست (به عنوان مثال ، لیست مواد غذایی شما ).

اگر هیچ عنوانی توسط توسعه دهنده ارائه نشده باشد ، لیست خرید پیش فرض است.

متن رایگان

اندازه متن توصیه شده: زیر 25 کاراکتر (متن خیلی طولانی ممکن است بیضی نشان دهد)

برچسب های موردی مورد نیاز

لیست برچسب های مربوط به موارد موجود در لیست خرید.

حداقل 1 برچسب باید تهیه شود و تا 10 برچسب به ترتیب اولویت ارائه شود. تعداد واقعی برچسب های نمایش داده شده به ضریب فرم دستگاه بستگی دارد.

لیست برچسب های متن رایگان

اندازه متن توصیه شده: زیر 20 کاراکتر (متن خیلی طولانی ممکن است بیضی نشان دهد)

ShoppingReorderCluster

صفت مورد نیاز توضیحات قالب
عمل مورد نیاز

پیوند عمیق برای تغییر مکان در برنامه شریک زندگی.

توجه: می توانید از پیوندهای عمیق برای انتساب استفاده کنید. به این سؤالات متداول مراجعه کنید

اوری
متن عمل اختیاری

متن CALL TO ACTION از دکمه روی تنظیم مجدد (به عنوان مثال ، دوباره سفارش دهید ).

اگر هیچ متن اکشن توسط توسعه دهنده ارائه نشده باشد ، تنظیم مجدد پیش فرض است.

این ویژگی در نسخه 1.1.0 به بعد پشتیبانی می شود.

رشته
تعداد اقلام مورد نیاز

تعداد موارد (نه فقط تعداد محصولات) در سفارش قبلی.

به عنوان مثال: اگر در سفارش قبلی 3 قهوه کوچک و 1 کروسان وجود داشته باشد ، این تعداد باید 4 باشد.

عدد صحیح> = 1
عنوان مورد نیاز عنوان مورد دوباره.

متن رایگان

اندازه متن توصیه شده: زیر 40 کاراکتر (متن خیلی طولانی ممکن است بیضی نشان دهد)

برچسب های موردی

اختیاری

(در صورت عدم ارائه ، تصاویر پوستر باید ارائه شود)

لیست برچسب های مورد برای سفارش قبلی.

حداکثر 10 برچسب می تواند به ترتیب اولویت ارائه شود. تعداد واقعی برچسب های نمایش داده شده به ضریب فرم دستگاه بستگی دارد.

لیست متن رایگان

اندازه متن توصیه شده برای هر برچسب: زیر 20 کاراکتر (متن خیلی طولانی ممکن است بیضی نشان دهد)

تصاویر پوستر

اختیاری

(در صورت عدم ارائه ، برچسب های موردی باید ارائه شود)

تصاویر موارد به ترتیب قبلی.

حداکثر 10 تصویر به ترتیب اولویت ارائه می شود. تعداد واقعی تصاویر نمایش داده شده به ضریب فرم دستگاه بستگی دارد.

برای راهنمایی به مشخصات تصویر مراجعه کنید.

ShoppingOrderTrackingCluster

صفت مورد نیاز توضیحات قالب
عنوان مورد نیاز

عنوان کوتاهی از بسته بندی/موارد ردیابی شده یا شماره ردیابی.

متن رایگان

اندازه متن توصیه شده: 50 کاراکتر (متن خیلی طولانی بیضی نشان می دهد)

نوع سفارش مورد نیاز

عنوان کوتاهی از بسته بندی/موارد ردیابی شده یا شماره ردیابی.

enum: in_store_pickup ، same_day_delivery ، multi_day_delivery

وضعیت مورد نیاز

وضعیت فعلی سفارش.

به عنوان مثال: "دیر اجرای" ، "در ترانزیت" ، "تأخیر" ، "حمل شده" ، "تحویل" ، "خارج از سهام" ، "سفارش آماده"

متن رایگان

اندازه متن توصیه شده: 25 کاراکتر (متن خیلی طولانی بیضی نشان می دهد)

زمان سفارش مورد نیاز

زمان سنجی دوره در میلی ثانیه که در آن سفارش قرار گرفته است.

در صورت وجود پنجره زمان تحویل مورد انتظار ، زمان سفارش نمایش داده می شود

زمان سنجی دوره در میلی ثانیه
عمل مورد نیاز

پیوند عمیق به ردیابی سفارش در برنامه شریک زندگی.

اوری
OrderDeliveryTimeWindow (اختیاری) - یک پنجره زمانی را برای سفارش تنظیم کنید که از زمان سفارش به زمان تحویل مورد انتظار/واقعی ردیابی می شود.
OrderDeliveryTimeWindow - زمان شروع اختیاری

زمان سنجی دوره در میلی ثانیه در/پس از آن سفارش تحویل داده می شود یا برای وانت آماده می شود.

زمان سنجی دوره در میلی ثانیه
OrderDeliveryTimeWindow - زمان پایان اختیاری

زمان سنجی دوره در میلی ثانیه در/قبل از آن سفارش تحویل داده می شود یا برای وانت آماده می شود.

زمان سنجی دوره در میلی ثانیه
تصاویر پوستر اختیاری

تصویر یک مورد/محصول که بخشی از سفارش است.

نسبت ابعاد توصیه شده 1: 1 است

برای راهنمایی به مشخصات تصویر مراجعه کنید.
تعداد اقلام اختیاری تعداد موارد موجود در سفارش. عدد صحیح> = 1
توضیحات اختیاری

یک پاراگراف واحد برای توصیف موارد موجود در سفارش.

توجه: یا لیست توضیحات یا زیرنویس به کاربر نمایش داده می شود ، نه هر دو.

متن رایگان

اندازه متن توصیه شده: 180 بار

لیست زیرنویس اختیاری

حداکثر 3 زیرنویس ، با هر زیرنویس یک خط متن.

توجه: یا لیست توضیحات یا زیرنویس به کاربر نمایش داده می شود ، نه هر دو.

متن رایگان

اندازه متن توصیه شده برای هر زیرنویس: حداکثر 50 کاراکتر

مقدار سفارش - جریان فعلی اختیاری مقدار فعلی سفارش. متن رایگان
شماره سفارش اختیاری شماره/شناسه سفارش که می تواند برای شناسایی منحصر به فرد سفارش استفاده شود.

متن رایگان

اندازه متن توصیه شده: حداکثر 25 کاراکتر

شماره پیگیری اختیاری در صورت نیاز به تحویل ، شماره پیگیری برای تحویل سفارش/بسته در صورت نیاز به تحویل.

متن رایگان

اندازه متن توصیه شده: حداکثر 25 کاراکتر

مشخصات تصویر

مشخصات لازم برای دارایی های تصویر در زیر ذکر شده است:

نسبت ابعاد حداقل پیکسل پیکسل های توصیه شده

مربع (1x1)

برای خوشه های غیر برجسته ترجیح داده می شود

300x300 1200x1200

چشم انداز (1.91x1)

ترجیح داده شده برای خوشه های برجسته

600x314 1200x628
پرتره (4x5) 480x600 960x1200

فرمت های فایل

PNG ، JPG ، GIF استاتیک ، وب

حداکثر اندازه فایل

5120 KB

توصیه های اضافی

  • منطقه ایمن تصویر: محتوای مهم خود را در مرکز 80 ٪ از تصویر قرار دهید.
  • از پس زمینه شفاف استفاده کنید تا تصویر به درستی در تنظیمات تم تاریک و سبک نمایش داده شود.

مرحله 2: داده های خوشه ای را ارائه دهید

توصیه می شود که محتوای منتشر شده در پس زمینه (به عنوان مثال ، با استفاده از WorkManager ) اجرا شود و به طور منظم یا به صورت رویداد برنامه ریزی شود (به عنوان مثال ، هر بار که کاربر برنامه را باز می کند یا وقتی کاربر فقط چیزی را به سبد خرید خود اضافه کرده است).

AppEngageShoppingClient مسئول انتشار خوشه های خرید است.

API های زیر در معرض انتشار خوشه ها در مشتری قرار دارند:

  • isServiceAvailable
  • publishRecommendationClusters
  • publishFeaturedCluster
  • publishShoppingCart
  • publishShoppingCarts
  • publishShoppingList
  • publishShoppingReorderCluster
  • publishShoppingOrderTrackingCluster
  • publishUserAccountManagementRequest
  • updatePublishStatus
  • deleteRecommendationsClusters
  • deleteFeaturedCluster
  • deleteShoppingCartCluster
  • deleteShoppingListCluster
  • deleteShoppingReorderCluster
  • deleteShoppingOrderTrackingCluster
  • deleteUserManagementCluster
  • deleteClusters

isServiceAvailable

از این API برای بررسی اینکه آیا این سرویس برای ادغام در دسترس است و آیا محتوا می تواند در دستگاه ارائه شود ، استفاده می شود.

کاتلین

client.isServiceAvailable.addOnCompleteListener { task ->
    if (task.isSuccessful) {
        // Handle IPC call success
        if(task.result) {
          // Service is available on the device, proceed with content publish
          // calls.
        } else {
          // Service is not available, no further action is needed.
        }
    } else {
      // The IPC call itself fails, proceed with error handling logic here,
      // such as retry.
    }
}

جاوا

client.isServiceAvailable().addOnCompleteListener(task - > {
    if (task.isSuccessful()) {
        // Handle success
        if(task.getResult()) {
          // Service is available on the device, proceed with content
          // publish calls.
        } else {
          // Service is not available, no further action is needed.
        }
    } else {
      // The IPC call itself fails, proceed with error handling logic here,
      // such as retry.
    }
});

publishRecommendationClusters

از این API برای انتشار لیستی از اشیاء RecommendationCluster استفاده می شود.

یک شیء RecommendationCluster می تواند ویژگی های زیر را داشته باشد:

صفت مورد نیاز توضیحات
لیست خرید مورد نیاز لیستی از اشیاء خرید و فروش که توصیه های این خوشه توصیه را تشکیل می دهند.
عنوان مورد نیاز

عنوان خوشه توصیه.

اندازه متن توصیه شده: زیر 25 کاراکتر (متن خیلی طولانی ممکن است بیضی نشان دهد)

زیرنویس اختیاری زیرنویس برای خوشه توصیه.
عمل اختیاری

پیوند عمیق به صفحه در برنامه شریک زندگی که در آن کاربران می توانند لیست کاملی از توصیه ها را مشاهده کنند.

توجه: می توانید از پیوندهای عمیق برای انتساب استفاده کنید. به این سؤالات متداول مراجعه کنید

کاتلین

client.publishRecommendationClusters(
            PublishRecommendationClustersRequest.Builder()
                .addRecommendationCluster(
                    RecommendationCluster.Builder()
                        .addEntity(entity1)
                        .addEntity(entity2)
                        .setTitle("Black Friday Deals")
                        .build())
                .build())

جاوا

client.publishRecommendationClusters(
            new PublishRecommendationClustersRequest.Builder()
                .addRecommendationCluster(
                    new RecommendationCluster.Builder()
                        .addEntity(entity1)
                        .addEntity(entity2)
                        .setTitle("Black Friday Deals")
                        .build())
                .build());

هنگامی که سرویس درخواست را دریافت می کند ، اقدامات زیر در یک معامله انجام می شود:

  • تمام داده های خوشه توصیه های موجود حذف می شوند.
  • داده های این درخواست در خوشه های توصیه جدید تجزیه و ذخیره می شوند.

در صورت بروز خطا ، کل درخواست رد می شود و وضعیت موجود حفظ می شود.

publishFeaturedCluster

از این API برای انتشار یک شیء FeaturedCluster استفاده می شود.

کاتلین

client.publishFeaturedCluster(
            PublishFeaturedClusterRequest.Builder()
                .setFeaturedCluster(
                    FeaturedCluster.Builder()
                        ...
                        .build())
                .build())

جاوا

client.publishFeaturedCluster(
            new PublishFeaturedClusterRequest.Builder()
                .setFeaturedCluster(
                    new FeaturedCluster.Builder()
                        ...
                        .build())
                .build());

هنگامی که سرویس درخواست را دریافت می کند ، اقدامات زیر در یک معامله انجام می شود:

  • داده های FeaturedCluster موجود از شریک توسعه دهنده حذف می شود.
  • داده های حاصل از درخواست تجزیه و در خوشه برجسته به روز شده ذخیره می شود.

در صورت بروز خطا ، کل درخواست رد می شود و وضعیت موجود حفظ می شود.

publishShoppingCart

از این API برای انتشار یک شیء ShoppingCartCluster استفاده می شود.

کاتلین

client.publishShoppingCart(
            PublishShoppingCartRequest.Builder()
                .setShoppingCart(
                    ShoppingCart.Builder()
                        ...
                        .build())
                .build())

جاوا

client.publishShoppingCart(
            new PublishShoppingCartRequest.Builder()
                .setShoppingCart(
                    new ShoppingCart.Builder()
                        ...
                        .build())
                .build())

هنگامی که سرویس درخواست را دریافت می کند ، اقدامات زیر در یک معامله انجام می شود:

  • داده های ShoppingCart موجود از شریک توسعه دهنده حذف می شود.
  • داده های این درخواست در خوشه سبد خرید به روز شده تجزیه و ذخیره می شوند.

در صورت بروز خطا ، کل درخواست رد می شود و وضعیت موجود حفظ می شود.

publishShoppingCarts

از این API برای انتشار چندین اشیاء ShoppingCart استفاده می شود. این کار برای انتشار شریک توسعه دهنده چرخ دستی های جداگانه برای هر بازرگان کاربرد دارد. هنگام استفاده از این API ، نام بازرگان را در عنوان قرار دهید.

کاتلین

client.publishShoppingCarts(
            PublishShoppingCartClustersRequest.Builder()
                .addShoppingCart(
                    ShoppingCart.Builder()
                        ...
                        .build())
                .build())

جاوا

client.publishShoppingCarts(
            new PublishShoppingCartClustersRequest.Builder()
                .addShoppingCart(
                    new ShoppingCart.Builder()
                        ...
                        .build())
                .build())

هنگامی که سرویس درخواست را دریافت می کند ، اقدامات زیر در یک معامله انجام می شود:

  • داده های ShoppingCart موجود از شریک توسعه دهنده حذف می شود.
  • داده های این درخواست در خوشه سبد خرید به روز شده تجزیه و ذخیره می شوند.

در صورت بروز خطا ، کل درخواست رد می شود و وضعیت موجود حفظ می شود.

publishShoppingList

این API برای انتشار یک شیء FoodShoppingList استفاده می شود.

کاتلین

client.publishFoodShoppingList(
            PublishFoodShoppingListRequest.Builder()
                .setFoodShoppingList(
                    FoodShoppingListEntity.Builder()
                        ...
                        .build())
                .build())

جاوا

client.publishFoodShoppingList(
            new PublishFoodShoppingListRequest.Builder()
                .setFoodShoppingList(
                    new FoodShoppingListEntity.Builder()
                        ...
                        .build())
                .build());

هنگامی که سرویس درخواست را دریافت می کند ، اقدامات زیر در یک معامله انجام می شود:

  • داده های موجود FoodShoppingList از شریک توسعه دهنده حذف می شود.
  • داده های این درخواست در خوشه لیست خرید به روز شده تجزیه و ذخیره می شوند.

در صورت بروز خطا ، کل درخواست رد می شود و وضعیت موجود حفظ می شود.

publishShoppingReorderCluster

از این API برای انتشار یک شی ShoppingReorderCluster استفاده می شود.

کاتلین

client.publishShoppingReorderCluster(
            PublishShoppingReorderClusterRequest.Builder()
                .setReorderCluster(
                    ShoppingReorderCluster.Builder()
                        ...
                        .build())
                .build())

جاوا

client.publishShoppingReorderCluster(
            new PublishShoppingReorderClusterRequest.Builder()
                .setReorderCluster(
                    new ShoppingReorderCluster.Builder()
                        ...
                        .build())
                .build());

هنگامی که سرویس درخواست را دریافت می کند ، اقدامات زیر در یک معامله انجام می شود:

  • داده های موجود ShoppingReorderCluster از شریک توسعه دهنده حذف می شود.
  • داده های حاصل از درخواست تجزیه و در خوشه به روز شده به روز شده ذخیره می شود.

در صورت بروز خطا ، کل درخواست رد می شود و وضعیت موجود حفظ می شود.

publishShoppingOrderTrackingCluster

از این API برای انتشار یک شیء ShoppingOrderTrackingCluster استفاده می شود.

کاتلین

client.publishShoppingOrderTrackingCluster(
            PublishShoppingOrderTrackingClusterRequest.Builder()
                .setShoppingOrderTrackingCluster(
                    ShoppingOrderTrackingCluster.Builder()
                        ...
                        .build())
                .build())

جاوا

client.publishShoppingOrderTrackingCluster(
            new PublishShoppingOrderTrackingClusterRequest.Builder()
                .setShoppingOrderTrackingCluster(
                    new ShoppingOrderTrackingCluster.Builder()
                        ...
                        .build())
                .build());

هنگامی که سرویس درخواست را دریافت می کند ، اقدامات زیر در یک معامله انجام می شود:

  • داده های موجود در مورد ShoppingOrderTrackingCluster از شریک توسعه دهنده حذف می شود.
  • داده های این درخواست در خوشه ردیابی سفارش خرید به روز شده تجزیه و ذخیره می شوند.

در صورت بروز خطا ، کل درخواست رد می شود و وضعیت موجود حفظ می شود.

publishUserAccountManagementRequest

این API برای انتشار یک علامت در کارت استفاده می شود. اقدام Signin کاربران را به صفحه ورود به سیستم هدایت می کند تا برنامه بتواند محتوا را منتشر کند (یا محتوای شخصی تر ارائه می دهد)

ابرداده زیر بخشی از علامت در کارت است -

صفت مورد نیاز توضیحات
عمل مورد نیاز Deeplink to Action (یعنی به سیستم ورود به سیستم وارد صفحه می شود)
تصویر اختیاری - در صورت عدم ارائه ، عنوان باید ارائه شود

تصویر نشان داده شده روی کارت

16x9 تصاویر نسبت ابعاد با وضوح 1264x712

عنوان اختیاری - در صورت عدم ارائه ، تصویر باید ارائه شود عنوان روی کارت
متن عمل اختیاری متن نشان داده شده در CTA (یعنی ورود به سیستم)
زیرنویس اختیاری زیرنویس اختیاری روی کارت

کاتلین

var SIGN_IN_CARD_ENTITY =
      SignInCardEntity.Builder()
          .addPosterImage(
              Image.Builder()
                  .setImageUri(Uri.parse("http://www.x.com/image.png"))
                  .setImageHeightInPixel(500)
                  .setImageWidthInPixel(500)
                  .build())
          .setActionText("Sign In")
          .setActionUri(Uri.parse("http://xx.com/signin"))
          .build()

client.publishUserAccountManagementRequest(
            PublishUserAccountManagementRequest.Builder()
                .setSignInCardEntity(SIGN_IN_CARD_ENTITY)
                .build());

جاوا

SignInCardEntity SIGN_IN_CARD_ENTITY =
      new SignInCardEntity.Builder()
          .addPosterImage(
              new Image.Builder()
                  .setImageUri(Uri.parse("http://www.x.com/image.png"))
                  .setImageHeightInPixel(500)
                  .setImageWidthInPixel(500)
                  .build())
          .setActionText("Sign In")
          .setActionUri(Uri.parse("http://xx.com/signin"))
          .build();

client.publishUserAccountManagementRequest(
            new PublishUserAccountManagementRequest.Builder()
                .setSignInCardEntity(SIGN_IN_CARD_ENTITY)
                .build());

هنگامی که سرویس درخواست را دریافت می کند ، اقدامات زیر در یک معامله انجام می شود:

  • داده های موجود در مورد UserAccountManagementCluster از شریک توسعه دهنده حذف می شود.
  • داده های این درخواست در خوشه به روز شده UserAccountManagementCluster به روز شده و ذخیره می شوند.

در صورت بروز خطا ، کل درخواست رد می شود و وضعیت موجود حفظ می شود.

updatePublishStatus

اگر به هر دلیل تجاری داخلی ، هیچ یک از خوشه ها منتشر نشده باشد ، ما اکیداً توصیه می کنیم وضعیت انتشار را با استفاده از API UpdatePublishStatus به روز کنید. این مهم است زیرا:

  • ارائه وضعیت در تمام سناریوها ، حتی در صورت انتشار محتوا (وضعیت == منتشر شده) ، برای جمع آوری داشبورد که از این وضعیت صریح برای انتقال سلامت و سایر معیارهای ادغام شما استفاده می کنند ، بسیار مهم است.
  • اگر هیچ محتوا منتشر نشده باشد اما وضعیت ادغام شکسته نشده است (وضعیت == not_published) ، Google می تواند از ایجاد هشدارها در داشبورد سلامت برنامه جلوگیری کند. این تأیید می کند که محتوا به دلیل وضعیت مورد انتظار از نظر ارائه دهنده منتشر نمی شود.
  • این به توسعه دهندگان کمک می کند تا بینش در مورد زمان انتشار داده ها در مقابل نه.
  • Google ممکن است از کدهای وضعیت استفاده کند تا کاربر را برای انجام اقدامات خاص در برنامه انجام دهد تا بتواند محتوای برنامه را ببیند یا بر آن غلبه کند.

لیست کدهای وضعیت انتشار واجد شرایط عبارتند از:

// Content is published
AppEngagePublishStatusCode.PUBLISHED,

// Content is not published as user is not signed in
AppEngagePublishStatusCode.NOT_PUBLISHED_REQUIRES_SIGN_IN,

// Content is not published as user is not subscribed
AppEngagePublishStatusCode.NOT_PUBLISHED_REQUIRES_SUBSCRIPTION,

// Content is not published as user location is ineligible
AppEngagePublishStatusCode.NOT_PUBLISHED_INELIGIBLE_LOCATION,

// Content is not published as there is no eligible content
AppEngagePublishStatusCode.NOT_PUBLISHED_NO_ELIGIBLE_CONTENT,

// Content is not published as the feature is disabled by the client
// Available in v1.3.1
AppEngagePublishStatusCode.NOT_PUBLISHED_FEATURE_DISABLED_BY_CLIENT,

// Content is not published as the feature due to a client error
// Available in v1.3.1
AppEngagePublishStatusCode.NOT_PUBLISHED_CLIENT_ERROR,

// Content is not published as the feature due to a service error
// Available in v1.3.1
AppEngagePublishStatusCode.NOT_PUBLISHED_SERVICE_ERROR,

// Content is not published due to some other reason
// Reach out to engage-developers@ before using this enum.
AppEngagePublishStatusCode.NOT_PUBLISHED_OTHER

اگر محتوا به دلیل ورود به سیستم وارد نشده ، منتشر نشده باشد ، Google توصیه می کند که علامت کارت را منتشر کند. اگر به هر دلیلی ارائه دهندگان قادر به انتشار علامت در کارت نیستند ، توصیه می کنیم با کد وضعیت به روزرسانی updatepublishstatus با کد وضعیت not_published_requires_sign_in تماس بگیرید

کاتلین

client.updatePublishStatus(
   PublishStatusRequest.Builder()
     .setStatusCode(AppEngagePublishStatusCode.NOT_PUBLISHED_REQUIRES_SIGN_IN)
     .build())

جاوا

client.updatePublishStatus(
    new PublishStatusRequest.Builder()
        .setStatusCode(AppEngagePublishStatusCode.NOT_PUBLISHED_REQUIRES_SIGN_IN)
        .build());

deleteRecommendationClusters

این API برای حذف محتوای خوشه های توصیه استفاده می شود.

کاتلین

client.deleteRecommendationClusters()

جاوا

client.deleteRecommendationClusters();

هنگامی که سرویس درخواست را دریافت می کند ، داده های موجود را از خوشه های توصیه حذف می کند. در صورت بروز خطا ، کل درخواست رد می شود و وضعیت موجود حفظ می شود.

deleteFeaturedCluster

این API برای حذف محتوای خوشه برجسته استفاده می شود.

کاتلین

client.deleteFeaturedCluster()

جاوا

client.deleteFeaturedCluster();

هنگامی که سرویس درخواست را دریافت می کند ، داده های موجود را از خوشه برجسته حذف می کند. در صورت بروز خطا ، کل درخواست رد می شود و وضعیت موجود حفظ می شود.

deleteShoppingCartCluster

این API برای حذف محتوای خوشه سبد خرید استفاده می شود.

کاتلین

client.deleteShoppingCartCluster()

جاوا

client.deleteShoppingCartCluster();

هنگامی که سرویس درخواست را دریافت می کند ، داده های موجود را از خوشه سبد خرید حذف می کند. در صورت بروز خطا ، کل درخواست رد می شود و وضعیت موجود حفظ می شود.

deleteShoppingListCluster

این API برای حذف محتوای خوشه لیست خرید استفاده می شود.

کاتلین

client.deleteShoppingListCluster()

جاوا

client.deleteShoppingListCluster();

هنگامی که سرویس درخواست را دریافت می کند ، داده های موجود را از خوشه لیست خرید حذف می کند. در صورت بروز خطا ، کل درخواست رد می شود و وضعیت موجود حفظ می شود.

deleteShoppingReorderCluster

از این API برای حذف محتوای خوشه سفارش خرید استفاده می شود.

کاتلین

client.deleteShoppingReorderCluster()

جاوا

client.deleteShoppingReorderCluster();

هنگامی که سرویس درخواست را دریافت می کند ، داده های موجود را از خوشه تغییرگر خرید حذف می کند. در صورت بروز خطا ، کل درخواست رد می شود و وضعیت موجود حفظ می شود.

deleteShoppingOrderTrackingCluster

این API برای حذف محتوای خوشه ردیابی سفارش خرید استفاده می شود.

کاتلین

client.deleteShoppingOrderTrackingCluster()

جاوا

client.deleteShoppingOrderTrackingCluster();

هنگامی که سرویس درخواست را دریافت می کند ، داده های موجود را از خوشه ردیابی سفارش خرید حذف می کند. در صورت بروز خطا ، کل درخواست رد می شود و وضعیت موجود حفظ می شود.

deleteUserManagementCluster

از این API برای حذف محتوای خوشه UserAccountManagement استفاده می شود.

کاتلین

client.deleteUserManagementCluster()

جاوا

client.deleteUserManagementCluster();

هنگامی که سرویس درخواست را دریافت می کند ، داده های موجود را از خوشه UserAccountManagement حذف می کند. در صورت بروز خطا ، کل درخواست رد می شود و وضعیت موجود حفظ می شود.

deleteClusters

این API برای حذف محتوای یک نوع خوشه معین استفاده می شود.

کاتلین

client.deleteClusters(
    DeleteClustersRequest.Builder()
      .addClusterType(ClusterType.TYPE_FEATURED)
      .addClusterType(ClusterType.TYPE_RECOMMENDATION)
      ...
      .build())

جاوا

client.deleteClusters(
            new DeleteClustersRequest.Builder()
                .addClusterType(ClusterType.TYPE_FEATURED)
                .addClusterType(ClusterType.TYPE_RECOMMENDATION)
                ...
                .build());

هنگامی که سرویس درخواست را دریافت می کند ، داده های موجود را از تمام خوشه های مطابق با انواع خوشه های مشخص شده حذف می کند. مشتریان می توانند یک یا بسیاری از انواع خوشه ها را تصویب کنند. در صورت بروز خطا ، کل درخواست رد می شود و وضعیت موجود حفظ می شود.

رسیدگی به خطا

بسیار توصیه می شود که به نتیجه کار از API های انتشار گوش دهید به گونه ای که می توان یک اقدام پیگیری برای بازیابی و بازگرداندن یک کار موفق انجام داد.

کاتلین

client.publishRecommendationClusters(
        PublishRecommendationClustersRequest.Builder()
          .addRecommendationCluster(..)
          .build())
      .addOnCompleteListener { task ->
        if (task.isSuccessful) {
          // do something
        } else {
          val exception = task.exception
          if (exception is AppEngageException) {
            @AppEngageErrorCode val errorCode = exception.errorCode
            if (errorCode == AppEngageErrorCode.SERVICE_NOT_FOUND) {
              // do something
            }
          }
        }
      }

جاوا

client.publishRecommendationClusters(
              new PublishRecommendationClustersRequest.Builder()
                  .addRecommendationCluster(...)
                  .build())
          .addOnCompleteListener(
              task -> {
                if (task.isSuccessful()) {
                  // do something
                } else {
                  Exception exception = task.getException();
                  if (exception instanceof AppEngageException) {
                    @AppEngageErrorCode
                    int errorCode = ((AppEngageException) exception).getErrorCode();
                    if (errorCode == AppEngageErrorCode.SERVICE_NOT_FOUND) {
                      // do something
                    }
                  }
                }
              });

این خطا به عنوان یک AppEngageException با علت موجود به عنوان کد خطا بازگردانده می شود.

کد خطا نام خطا توجه داشته باشید
1 SERVICE_NOT_FOUND این سرویس در دستگاه داده شده در دسترس نیست.
2 SERVICE_NOT_AVAILABLE این سرویس در دستگاه داده شده در دسترس است ، اما در زمان تماس در دسترس نیست (به عنوان مثال ، صریحاً غیرفعال است).
3 SERVICE_CALL_EXECUTION_FAILURE اجرای وظیفه به دلیل مشکلات مربوط به موضوعات انجام نشد. در این حالت ، می توان آن را مجدداً انجام داد.
4 SERVICE_CALL_PERMISSION_DENIED تماس گیرنده مجاز به برقراری تماس خدمات نیست.
5 SERVICE_CALL_INVALID_ARGUMENT این درخواست حاوی داده های نامعتبر است (به عنوان مثال ، بیش از تعداد خوشه مجاز).
6 SERVICE_CALL_INTERNAL خطایی در سمت سرویس وجود دارد.
7 SERVICE_CALL_RESOURCE_EXHAUSTED تماس خدمات بیش از حد مکرر انجام می شود.

مرحله 3: اهداف پخش را کنترل کنید

علاوه بر ایجاد تماس های API Publish Content از طریق یک کار ، همچنین لازم است که برای دریافت درخواست انتشار محتوا ، یک BroadcastReceiver تنظیم کنید.

هدف از اهداف پخش عمدتاً برای فعال سازی مجدد برنامه و مجبور کردن همگام سازی داده ها است. اهداف پخش به گونه ای طراحی نشده است که به طور مکرر ارسال می شود. این تنها هنگامی ایجاد می شود که سرویس ENGAGE تعیین کند که محتوا ممکن است بی رنگ باشد (به عنوان مثال ، یک هفته). به این ترتیب ، اطمینان بیشتری وجود دارد که کاربر می تواند تجربه محتوای تازه ای داشته باشد ، حتی اگر برنامه برای مدت طولانی اجرا نشده باشد.

BroadcastReceiver باید به دو روش زیر تنظیم شود:

  • به صورت پویا نمونه ای از کلاس BroadcastReceiver را با استفاده از Context.registerReceiver() ثبت کنید. این امکان ارتباط از برنامه هایی را فراهم می کند که هنوز در حافظه زندگی می کنند.

کاتلین

class AppEngageBroadcastReceiver : BroadcastReceiver(){
  // Trigger recommendation cluster publish when PUBLISH_RECOMMENDATION
  // broadcast is received
  // Trigger featured cluster publish when PUBLISH_FEATURED broadcast is
  // received
  // Trigger shopping cart cluster publish when PUBLISH_SHOPPING_CART broadcast
  // is received
  // Trigger shopping list cluster publish when PUBLISH_SHOPPING_LIST broadcast
  // is received
  // Trigger reorder cluster publish when PUBLISH_REORDER_CLUSTER broadcast is
  // received
  // Trigger shopping order tracking cluster publish when
  // PUBLISH_SHOPPING_ORDER_TRACKING_CLUSTER broadcast is received
}

fun registerBroadcastReceivers(context: Context){
  var  context = context
  context = context.applicationContext

// Register Recommendation Cluster Publish Intent
  context.registerReceiver(AppEngageBroadcastReceiver(),
                           IntentFilter(Intents.ACTION_PUBLISH_RECOMMENDATION))

// Register Featured Cluster Publish Intent
  context.registerReceiver(AppEngageBroadcastReceiver(),
                           IntentFilter(Intents.ACTION_PUBLISH_FEATURED))

// Register Shopping Cart Cluster Publish Intent
  context.registerReceiver(AppEngageBroadcastReceiver(),
                           IntentFilter(Intents.ACTION_PUBLISH_SHOPPING_CART))

// Register Shopping List Cluster Publish Intent
  context.registerReceiver(AppEngageBroadcastReceiver(),
                           IntentFilter(Intents.ACTION_PUBLISH_SHOPPING_LIST))

// Register Reorder Cluster Publish Intent
  context.registerReceiver(AppEngageBroadcastReceiver(),
                           IntentFilter(Intents.ACTION_PUBLISH_REORDER_CLUSTER))

// Register Shopping Order Tracking Cluster Publish Intent
  context.registerReceiver(AppEngageBroadcastReceiver(),
                           IntentFilter(Intents.ACTION_PUBLISH_SHOPPING_ORDER_TRACKING_CLUSTER))
}

جاوا

class AppEngageBroadcastReceiver extends BroadcastReceiver {
// Trigger recommendation cluster publish when PUBLISH_RECOMMENDATION broadcast
// is received

// Trigger featured cluster publish when PUBLISH_FEATURED broadcast is received

// Trigger shopping cart cluster publish when PUBLISH_SHOPPING_CART broadcast is
// received

// Trigger shopping list cluster publish when PUBLISH_SHOPPING_LIST broadcast is
// received

// Trigger reorder cluster publish when PUBLISH_REORDER_CLUSTER broadcast is
// received

// Trigger reorder cluster publish when PUBLISH_SHOPPING_ORDER_TRACKING_CLUSTER
// broadcast is received
}

public static void registerBroadcastReceivers(Context context) {

context = context.getApplicationContext();

// Register Recommendation Cluster Publish Intent
context.registerReceiver(new AppEngageBroadcastReceiver(),
new IntentFilter(com.google.android.engage.service.Intents.ACTION_PUBLISH_RECOMMENDATION));

// Register Featured Cluster Publish Intent
context.registerReceiver(new AppEngageBroadcastReceiver(),
new IntentFilter(com.google.android.engage.service.Intents.ACTION_PUBLISH_FEATURED));

// Register Shopping Cart Cluster Publish Intent
context.registerReceiver(new AppEngageBroadcastReceiver(),
new IntentFilter(com.google.android.engage.shopping.service.Intents.ACTION_PUBLISH_SHOPPING_CART));

// Register Shopping List Cluster Publish Intent
context.registerReceiver(new AppEngageBroadcastReceiver(),
new IntentFilter(com.google.android.engage.shopping.service.Intents.ACTION_PUBLISH_SHOPPING_LIST));

// Register Reorder Cluster Publish Intent
context.registerReceiver(new AppEngageBroadcastReceiver(),
new IntentFilter(com.google.android.engage.shopping.service.Intents.ACTION_PUBLISH_REORDER_CLUSTER));

// Register Shopping Order Tracking Cluster Publish Intent
context.registerReceiver(new AppEngageBroadcastReceiver(),
new IntentFilter(com.google.android.engage.shopping.service.Intents.ACTION_PUBLISH_SHOPPING_ORDER_TRACKING_CLUSTER));

}
  • به صورت آماری با برچسب <receiver> در پرونده AndroidManifest.xml خود یک اجرای را اعلام کنید. این امر به برنامه اجازه می دهد تا هنگام اجرا ، اهداف پخش را دریافت کند و همچنین به برنامه اجازه می دهد تا محتوا را منتشر کند.
<application>
   <receiver
      android:name=".AppEngageBroadcastReceiver"
      android:exported="true"
      android:enabled="true">
      <intent-filter>
         <action android:name="com.google.android.engage.action.PUBLISH_RECOMMENDATION" />
      </intent-filter>
      <intent-filter>
         <action android:name="com.google.android.engage.action.PUBLISH_FEATURED" />
      </intent-filter>
      <intent-filter>
         <action android:name="com.google.android.engage.action.shopping.PUBLISH_SHOPPING_CART" />
      </intent-filter>
      <intent-filter>
         <action android:name="com.google.android.engage.action.shopping.PUBLISH_SHOPPING_LIST" />
      </intent-filter>
      <intent-filter>
         <action android:name="com.google.android.engage.action.shopping.PUBLISH_REORDER_CLUSTER" />
      </intent-filter>
      <intent-filter>
         <action android:name="com.google.android.engage.action.shopping.PUBLISH_SHOPPING_ORDER_TRACKING_CLUSTER" />
      </intent-filter>
   </receiver>
</application>

اهداف زیر توسط سرویس ارسال می شود:

  • com.google.android.engage.action.PUBLISH_RECOMMENDATION توصیه می شود هنگام دریافت این هدف ، تماس publishRecommendationClusters را شروع کنید.
  • com.google.android.engage.action.PUBLISH_FEATURED توصیه می شود هنگام دریافت این هدف ، یک تماس تلفنی publishFeaturedCluster کنید.
  • com.google.android.engage.action.shopping.PUBLISH_SHOPPING_CART توصیه می شود هنگام دریافت این هدف ، یک تماس publishShoppingCart شروع کنید.
  • com.google.android.engage.action.shopping.PUBLISH_SHOPPING_LIST توصیه می شود هنگام دریافت این هدف ، یک تماس publishShoppingList شروع کنید.
  • com.google.android.engage.action.shopping.PUBLISH_REORDER_CLUSTER توصیه می شود هنگام دریافت این هدف ، یک تماس publishReorderCluster شروع کنید.
  • com.google.android.engage.action.shopping.PUBLISH_SHOPPING_ORDER_TRACKING_CLUSTER توصیه می شود هنگام دریافت این هدف ، یک تماس publishShoppingOrderTrackingCluster را شروع کنید.

گردش کار ادغام

برای یک راهنمای گام به گام در مورد تأیید ادغام خود پس از اتمام ، به گردش کار ادغام Engage Developer مراجعه کنید.

سوالات متداول

به Engage SDK که اغلب برای سؤالات متداول پرسیده می شود ، مراجعه کنید.

تماس بگیرید

در صورت وجود هرگونه سؤال در طی فرآیند ادغام ، با ingage-developers@google.com تماس بگیرید. تیم ما در اسرع وقت پاسخ می دهد.

مراحل بعدی

پس از تکمیل این ادغام ، مراحل بعدی شما به شرح زیر است:

  • یک ایمیل برای Engage-develors@google.com ارسال کرده و APK یکپارچه خود را که آماده آزمایش توسط Google است ، ضمیمه کنید.
  • Google یک تأیید را انجام می دهد و در داخل کشور بررسی می کند تا اطمینان حاصل شود که ادغام همانطور که انتظار می رود کار می کند. در صورت نیاز به تغییرات ، Google با هرگونه جزئیات لازم با شما تماس می گیرد.
  • هنگامی که آزمایش کامل است و هیچ تغییری لازم نیست ، Google با شما تماس می گیرد تا به شما اطلاع دهد که می توانید APK به روز شده و یکپارچه را در فروشگاه Play شروع کنید.
  • بعد از اینکه گوگل تأیید کرد که APK به روز شده شما در فروشگاه Play منتشر شده است ، توصیه شما ، برجسته ، سبد خرید ، لیست خرید ، خوشه ترتیب و سفارش خرید ممکن است خوشه های خوشه ای منتشر و برای کاربران قابل مشاهده باشد.
،

Google در حال ساخت یک سطح دستگاه است که برنامه های کاربران را توسط عمودی سازماندهی می کند و یک تجربه همهجانبه جدید را برای مصرف و کشف محتوای برنامه شخصی امکان پذیر می کند. این تجربه تمام صفحه ، فرصتی را برای شرکای توسعه دهنده فراهم می کند تا بهترین محتوای غنی خود را در یک کانال اختصاصی در خارج از برنامه خود به نمایش بگذارند.

این راهنما شامل دستورالعمل هایی برای شرکای توسعه دهنده برای ادغام محتوای خرید خود ، با استفاده از SDK Engage برای جمع آوری هم در سطح جدید و هم سطوح گوگل موجود مانند فضای سرگرمی است.

جزئیات ادغام

اصطلاحات

این ادغام شامل پنج نوع خوشه زیر است: توصیه ، برجسته ، سبد خرید ، لیست خرید ، ردیابی سفارش و سفارش خرید .

  • خوشه های توصیه پیشنهادات خرید شخصی را از یک شریک توسعه دهنده خاص نشان می دهند. These recommendations can be personalized to the user or generalized (for example, trending items). Use these to surface products, events, sales, promos, subscriptions as you see fit.

    Your recommendations take the following structure:

    • Recommendation Cluster: A UI view that contains a group of recommendations from the same developer partner.

    • ShoppingEntity: An object representing a single item in a cluster.

  • The Featured cluster showcases a selection of entities from multiple developer partners in one UI grouping. There will be a single Featured cluster, which is surfaced near the top of the UI with a priority placement above all Recommendation clusters. Each developer partner will be allowed to broadcast up to 10 entities in the Featured cluster.

  • The Shopping Cart cluster shows a sneak peek of shopping carts from many developer partners in one UI grouping, nudging users to complete their outstanding carts. There is a single Shopping Cart cluster, which is surfaced near the top of the UI, with a priority placement above all Recommendation clusters. Each developer partner is allowed to broadcast up to 3 ShoppingCart instances in the Shopping Cart cluster.

    Your Shopping Cart takes the following structure:

    • Shopping Cart Cluster: A UI view that contains a group of shopping cart previews from many developer partners.

    • ShoppingCart: An object representing the shopping cart preview for a single developer partner, to be displayed in the Shopping Cart cluster. The ShoppingCart must show the total count of items in the cart and may also include images for some items in the user's cart.

  • The Shopping List cluster shows a sneak peek of the shopping lists from multiple developer partners in one UI grouping, prompting users to return to the corresponding app to update and complete their lists. There is a single Shopping List cluster.

  • The Reorder cluster shows a sneak peek of the previous orders from multiple developer partners in one UI grouping, prompting users to reorder. There is a single Reorder cluster.

    • Reorder cluster must show the total count of items in the user's previous order and must also include one of the following:

      • Images for X items in the user's previous order.
      • Labels for X items in the user's previous order.
  • The Shopping Order Tracking cluster shows a sneak peek of pending or recently completed shopping orders from many developer partners in one UI grouping, allowing users to track their orders.

    There is a single ShoppingOrderTracking cluster that is surfaced near the top of the UI, with a priority placement above all Recommendation clusters. Each developer partner is allowed to broadcast multiple ShoppingOrderTrackingEntity items in the Shopping Order Tracking cluster.

    • Your ShoppingOrderTrackingCluster takes the following structure:

      • ShoppingOrderTracking Cluster : A UI view that contains a group of order tracking previews from many developer partners
      • ShoppingOrderTrackingEntity : An object representing a shopping order tracking preview for a single developer partner, to be displayed in the Shopping Order Tracking cluster. The ShoppingOrderTrackingEntity must show the status of the order and the order time. We strongly recommend populating the expected delivery time for ShoppingOrderTrackingEntity, as it's displayed to users when provided.

Pre-work

Minimum API level: 19

Add the com.google.android.engage:engage-core library to your app:

dependencies {
    // Make sure you also include that repository in your project's build.gradle file.
    implementation 'com.google.android.engage:engage-core:1.5.2'
}

For more information, see Package visibility in Android 11 .

خلاصه

The design is based on an implementation of a bound service .

The data a client can publish is subject to the following limits for different cluster types:

Cluster type Cluster limits Maximum entity limits in a cluster
Recommendation Cluster(s) At most 7 At most 50 ShoppingEntity
Featured Cluster حداکثر 1 At most 20 ShoppingEntity
Shopping Cart Cluster حداکثر 1 At most 3 ShoppingCart

Multiple carts only expected for apps with separate carts per merchant.

Shopping List Cluster حداکثر 1 At most 1 ShoppingListEntity
Shopping Reorder Cluster حداکثر 1 At most 1 ReorderEntity
Shopping Order Tracking Cluster حداکثر 3 At most 3 ShoppingOrderTrackingEntity

Step 1: Provide entity data

The SDK has defined different entities to represent each item type. The following entities are supported for the Shopping category:

  1. ShoppingEntity
  2. ShoppingCart
  3. ShoppingList
  4. Reorder
  5. ShoppingOrderTracking

The charts below outline available attributes and requirements for each type.

ShoppingEntity

The ShoppingEntity object represents a product, promotion, deal, subscription, or event that developer partners want to publish.

ShoppingEntity
صفت مورد نیاز توضیحات قالب
Poster images مورد نیاز At least one image must be provided. See Image Specifications for guidance.
Action Uri مورد نیاز

The deep link to the page in the app displaying details about the entity.

Note: You can use deep links for attribution. Refer to this FAQ

اوری
عنوان اختیاری The name of the entity.

متن رایگان

Recommended text size: under 90 chars (Text that is too long may show ellipses)

Price - current Conditionally required

The current price of the entity.

Must be provided if strikethrough price is provided.

متن رایگان
Price - strikethrough اختیاری The original price of the entity, which is be struck-through in the UI. متن رایگان
فراخوانی اختیاری Callout to feature a promo, event, or update for the entity, if available.

متن رایگان

Recommended text size: under 45 chars (Text that is too long may show ellipses)

Callout fine print اختیاری Fine print text for the callout.

متن رایگان

Recommended text size: under 45 chars (Text that is too long may show ellipses)

Rating (Optional) - Note: All ratings are displayed using our standard star rating system.
Rating - Max value اختیاری

The maximum value of the rating scale.

Must be provided if current value of rating is also provided.

Number >= 0.0
Rating - Current value اختیاری

The current value of the rating scale.

Must be provided if maximum value of rating is also provided.

Number >= 0.0
Rating - Count اختیاری

The count of the ratings for the entity.

Note: Provide this field if your app controls how the count is displayed to the users. Use a concise string. For example, if the count is 1,000,000, consider using an abbreviation like 1M so that the count isn't truncated on smaller display sizes.

رشته
Rating - Count Value اختیاری

The count of the ratings for the entity.

Note: Provide this field if you don't handle the display abbreviation logic yourself. If both Count and Count Value are present, Count is displayed to users.

طولانی
DisplayTimeWindow (Optional) - Set a time window for a content to be shown on the surface
Start Timestamp اختیاری

The epoch timestamp after which the content should be shown on the surface.

If not set, content is eligible to be shown on the surface.

Epoch timestamp in milliseconds
End Timestamp اختیاری

The epoch timestamp after which the content is no longer shown on the surface.

If not set, content is eligible to be shown on the surface.

Epoch timestamp in milliseconds

ShoppingCart

صفت مورد نیاز توضیحات قالب
Action Uri مورد نیاز

The deep link to the shopping cart in the partner's app.

Note: You can use deep links for attribution. Refer to this FAQ

اوری
تعداد اقلام مورد نیاز

The number of items (not just number of products) in the shopping cart.

For example: If there are 3 identical shirts and 1 hat in the cart, this number should be 4.

Integer >= 1
Action Text اختیاری

The call to action text of the button on the Shopping Cart (for example, Your Shopping Bag ).

If no action text is provided by the developer, View Cart is the default.

This attribute is supported in version 1.1.0 onwards.

رشته
عنوان اختیاری

The title of the cart (for example, Your Shopping Bag ).

If no title is provided by the developer, Your cart is the default.

If developer partner publishes a separate cart per merchant, please include merchant name in the title.

متن رایگان

Recommended text size: under 25 chars (Text that is too long may show ellipses)

Cart images اختیاری

Images of each product in the cart.

Up to 10 images can be provided in order of priority; the actual number of images displayed depends on the device form factor.

See Image Specifications for guidance.
Item labels اختیاری

The list of labels for items on the shopping list.

The actual number of labels displayed depends on the device form factor.

List of free text labels

Recommended text size: under 20 chars (Text that is too long may show ellipses)

Last user interaction timestamp اختیاری Number of milliseconds elapsed from the epoch, identifying the last time when user interacted with the cart.

This will be passed as input by the developer partners publishing separate cart per merchant and maybe used for ranking.

Epoch timestamp in milliseconds
DisplayTimeWindow (Optional) - Set a time window for a content to be shown on the surface
Start Timestamp اختیاری

The epoch timestamp after which the content should be shown on the surface.

If not set, content is eligible to be shown on the surface.

Epoch timestamp in milliseconds
End Timestamp اختیاری

The epoch timestamp after which the content is no longer shown on the surface.

If not set, content is eligible to be shown on the surface.

Epoch timestamp in milliseconds

ShoppingList

صفت مورد نیاز توضیحات قالب
Action Uri مورد نیاز

The deep link to the shopping list in the partner's app.

Note: You can use deep links for attribution. Refer to this FAQ

اوری
تعداد اقلام مورد نیاز The number of items in the shopping list. Integer >= 1
عنوان اختیاری

The title of the list (for example, Your Grocery List ).

If no title is provided by the developer, Shopping list is the default.

متن رایگان

Recommended text size: under 25 chars (Text that is too long may show ellipses)

Item labels مورد نیاز

The list of labels for items on the shopping list.

At least 1 label must be provided and up to 10 labels can be provided in order of priority; the actual number of labels displayed depends on the device form factor.

List of free text labels

Recommended text size: under 20 chars (Text that is too long may show ellipses)

ShoppingReorderCluster

صفت مورد نیاز توضیحات قالب
Action Uri مورد نیاز

The deep link to reorder in the partner's app.

Note: You can use deep links for attribution. Refer to this FAQ

اوری
Action Text اختیاری

The call to action text of the button on the Reorder (for example, Order again ).

If no action text is provided by the developer, Reorder is the default.

This attribute is supported in version 1.1.0 onwards.

رشته
تعداد اقلام مورد نیاز

The number of items (not just number of products) in the previous order.

For example: If there were 3 small coffees and 1 croissant in the previous order, this number should be 4.

Integer >= 1
عنوان مورد نیاز The title of the reorder item.

متن رایگان

Recommended text size: under 40 chars (Text that is too long may show ellipses)

Item labels

اختیاری

(If not provided, poster images should be provided)

The list of item labels for the previous order.

Up to 10 labels can be provided in order of priority; the actual number of labels displayed depends on the device form factor.

List of free text

Recommended text size per label: under 20 chars (Text that is too long may show ellipses)

Poster images

اختیاری

(If not provided, item labels should be provided)

Images of the items in the previous order.

Up to 10 images can be provided in order of priority; the actual number of images displayed depends on the device form factor.

See Image Specifications for guidance.

ShoppingOrderTrackingCluster

صفت مورد نیاز توضیحات قالب
عنوان مورد نیاز

A short title of the package/items being tracked or the tracking number.

متن رایگان

Recommended text size: 50 chars (Text that is too long will show ellipses)

نوع سفارش مورد نیاز

A short title of the package/items being tracked or the tracking number.

Enum: IN_STORE_PICKUP, SAME_DAY_DELIVERY, MULTI_DAY_DELIVERY

وضعیت مورد نیاز

The current status of the order.

For example: "Running late", "In transit", "Delayed", "Shipped", "Delivered", "Out of stock", "Order ready"

متن رایگان

Recommended text size: 25 chars (Text that is too long will show ellipses)

زمان سفارش مورد نیاز

The epoch timestamp in milliseconds at which the order was placed.

Order time will be displayed if expected delivery time window is not present

Epoch timestamp in milliseconds
Action Uri مورد نیاز

Deep link to the order tracking in the partner's app.

اوری
OrderDeliveryTimeWindow (Optional) - Set a time window for the order that is being tracked from the time the order was placed to the time of expected/actual delivery.
OrderDeliveryTimeWindow - Start Time اختیاری

The epoch timestamp in milliseconds on/after which the order will be delivered or be ready for pickup.

Epoch timestamp in milliseconds
OrderDeliveryTimeWindow - End Time اختیاری

The epoch timestamp in milliseconds on/before which the order will be delivered or be ready for pickup.

Epoch timestamp in milliseconds
Poster images اختیاری

Image of one item/product that is part of the order.

Recommended aspect ratio is 1:1

See Image Specifications for guidance.
تعداد اقلام اختیاری The number of items in the order. Integer >= 1
توضیحات اختیاری

A single paragraph of text to describe the items in the order.

Note: Either description or subtitle list will be displayed to the user, not both.

متن رایگان

Recommended text size: 180 chars

Subtitle list اختیاری

Up to 3 subtitles, with each subtitle a single line of text.

Note: Either description or subtitle list will be displayed to the user, not both.

متن رایگان

Recommended text size for each subtitle: max 50 chars

Order Value - CurrentPrice اختیاری The current value of the order. متن رایگان
شماره سفارش اختیاری The order number/ID that can be used to uniquely identify the order.

متن رایگان

Recommended text size: max 25 chars

شماره پیگیری اختیاری The tracking number for the order/parcel delivery in case the order requires a delivery.

متن رایگان

Recommended text size: max 25 chars

مشخصات تصویر

Required specifications for image assets are listed below:

نسبت ابعاد Minimum pixels Recommended pixels

Square (1x1)

Preferred for non featured clusters

300x300 1200x1200

Landscape (1.91x1)

Preferred for featured clusters

600x314 1200x628
Portrait (4x5) 480x600 960x1200

فرمت های فایل

PNG, JPG, static GIF, WebP

حداکثر اندازه فایل

5120 KB

توصیه های اضافی

  • Image safe area: Put your important content in the center 80% of the image.
  • Use a transparent background so that the image can be properly displayed in Dark and Light theme settings.

Step 2: Provide Cluster data

It is recommended to have the content publish job executed in the background (for example, using WorkManager ) and scheduled on a regular basis or on an event basis (for example, every time the user opens the app or when the user just added something to their cart).

AppEngageShoppingClient is responsible for publishing shopping clusters.

Following APIs are exposed to publish clusters in the client:

  • isServiceAvailable
  • publishRecommendationClusters
  • publishFeaturedCluster
  • publishShoppingCart
  • publishShoppingCarts
  • publishShoppingList
  • publishShoppingReorderCluster
  • publishShoppingOrderTrackingCluster
  • publishUserAccountManagementRequest
  • updatePublishStatus
  • deleteRecommendationsClusters
  • deleteFeaturedCluster
  • deleteShoppingCartCluster
  • deleteShoppingListCluster
  • deleteShoppingReorderCluster
  • deleteShoppingOrderTrackingCluster
  • deleteUserManagementCluster
  • deleteClusters

isServiceAvailable

This API is used to check if the service is available for integration and whether the content can be presented on the device.

کاتلین

client.isServiceAvailable.addOnCompleteListener { task ->
    if (task.isSuccessful) {
        // Handle IPC call success
        if(task.result) {
          // Service is available on the device, proceed with content publish
          // calls.
        } else {
          // Service is not available, no further action is needed.
        }
    } else {
      // The IPC call itself fails, proceed with error handling logic here,
      // such as retry.
    }
}

جاوا

client.isServiceAvailable().addOnCompleteListener(task - > {
    if (task.isSuccessful()) {
        // Handle success
        if(task.getResult()) {
          // Service is available on the device, proceed with content
          // publish calls.
        } else {
          // Service is not available, no further action is needed.
        }
    } else {
      // The IPC call itself fails, proceed with error handling logic here,
      // such as retry.
    }
});

publishRecommendationClusters

This API is used to publish a list of RecommendationCluster objects.

A RecommendationCluster object can have the following attributes:

صفت مورد نیاز توضیحات
List of ShoppingEntity مورد نیاز A list of ShoppingEntity objects that make up the recommendations for this Recommendation Cluster.
عنوان مورد نیاز

The title for the Recommendation Cluster.

Recommended text size: under 25 chars (Text that is too long may show ellipses)

زیرنویس اختیاری The subtitle for the Recommendation Cluster.
Action Uri اختیاری

The deep link to the page in the partner app where users can see the complete list of recommendations.

Note: You can use deep links for attribution. Refer to this FAQ

کاتلین

client.publishRecommendationClusters(
            PublishRecommendationClustersRequest.Builder()
                .addRecommendationCluster(
                    RecommendationCluster.Builder()
                        .addEntity(entity1)
                        .addEntity(entity2)
                        .setTitle("Black Friday Deals")
                        .build())
                .build())

جاوا

client.publishRecommendationClusters(
            new PublishRecommendationClustersRequest.Builder()
                .addRecommendationCluster(
                    new RecommendationCluster.Builder()
                        .addEntity(entity1)
                        .addEntity(entity2)
                        .setTitle("Black Friday Deals")
                        .build())
                .build());

When the service receives the request, the following actions take place within one transaction:

  • All existing Recommendation Cluster data is removed.
  • Data from the request is parsed and stored in new Recommendation Clusters.

In case of an error, the entire request is rejected and the existing state is maintained.

publishFeaturedCluster

This API is used to publish a FeaturedCluster object.

کاتلین

client.publishFeaturedCluster(
            PublishFeaturedClusterRequest.Builder()
                .setFeaturedCluster(
                    FeaturedCluster.Builder()
                        ...
                        .build())
                .build())

جاوا

client.publishFeaturedCluster(
            new PublishFeaturedClusterRequest.Builder()
                .setFeaturedCluster(
                    new FeaturedCluster.Builder()
                        ...
                        .build())
                .build());

When the service receives the request, the following actions take place within one transaction:

  • Existing FeaturedCluster data from the developer partner is removed.
  • Data from the request is parsed and stored in the updated Featured Cluster.

In case of an error, the entire request is rejected and the existing state is maintained.

publishShoppingCart

This API is used to publish a ShoppingCartCluster object.

کاتلین

client.publishShoppingCart(
            PublishShoppingCartRequest.Builder()
                .setShoppingCart(
                    ShoppingCart.Builder()
                        ...
                        .build())
                .build())

جاوا

client.publishShoppingCart(
            new PublishShoppingCartRequest.Builder()
                .setShoppingCart(
                    new ShoppingCart.Builder()
                        ...
                        .build())
                .build())

When the service receives the request, the following actions take place within one transaction:

  • Existing ShoppingCart data from the developer partner is removed.
  • Data from the request is parsed and stored in the updated Shopping Cart Cluster.

In case of an error, the entire request is rejected and the existing state is maintained.

publishShoppingCarts

This API is used to publish multiple ShoppingCart objects. This is applicable to developer partner publishing separate carts per merchant. Include merchant name in the title when using this API.

کاتلین

client.publishShoppingCarts(
            PublishShoppingCartClustersRequest.Builder()
                .addShoppingCart(
                    ShoppingCart.Builder()
                        ...
                        .build())
                .build())

جاوا

client.publishShoppingCarts(
            new PublishShoppingCartClustersRequest.Builder()
                .addShoppingCart(
                    new ShoppingCart.Builder()
                        ...
                        .build())
                .build())

When the service receives the request, the following actions take place within one transaction:

  • Existing ShoppingCart data from the developer partner is removed.
  • Data from the request is parsed and stored in the updated Shopping Cart Cluster.

In case of an error, the entire request is rejected and the existing state is maintained.

publishShoppingList

This API is used to publish a FoodShoppingList object.

کاتلین

client.publishFoodShoppingList(
            PublishFoodShoppingListRequest.Builder()
                .setFoodShoppingList(
                    FoodShoppingListEntity.Builder()
                        ...
                        .build())
                .build())

جاوا

client.publishFoodShoppingList(
            new PublishFoodShoppingListRequest.Builder()
                .setFoodShoppingList(
                    new FoodShoppingListEntity.Builder()
                        ...
                        .build())
                .build());

When the service receives the request, the following actions take place within one transaction:

  • Existing FoodShoppingList data from the developer partner is removed.
  • Data from the request is parsed and stored in the updated Shopping List Cluster.

In case of an error, the entire request is rejected and the existing state is maintained.

publishShoppingReorderCluster

This API is used to publish a ShoppingReorderCluster object.

کاتلین

client.publishShoppingReorderCluster(
            PublishShoppingReorderClusterRequest.Builder()
                .setReorderCluster(
                    ShoppingReorderCluster.Builder()
                        ...
                        .build())
                .build())

جاوا

client.publishShoppingReorderCluster(
            new PublishShoppingReorderClusterRequest.Builder()
                .setReorderCluster(
                    new ShoppingReorderCluster.Builder()
                        ...
                        .build())
                .build());

When the service receives the request, the following actions take place within one transaction:

  • Existing ShoppingReorderCluster data from the developer partner is removed.
  • Data from the request is parsed and stored in the updated Reorder Cluster.

In case of an error, the entire request is rejected and the existing state is maintained.

publishShoppingOrderTrackingCluster

This API is used to publish a ShoppingOrderTrackingCluster object.

کاتلین

client.publishShoppingOrderTrackingCluster(
            PublishShoppingOrderTrackingClusterRequest.Builder()
                .setShoppingOrderTrackingCluster(
                    ShoppingOrderTrackingCluster.Builder()
                        ...
                        .build())
                .build())

جاوا

client.publishShoppingOrderTrackingCluster(
            new PublishShoppingOrderTrackingClusterRequest.Builder()
                .setShoppingOrderTrackingCluster(
                    new ShoppingOrderTrackingCluster.Builder()
                        ...
                        .build())
                .build());

When the service receives the request, the following actions take place within one transaction:

  • Existing ShoppingOrderTrackingCluster data from the developer partner is removed.
  • Data from the request is parsed and stored in the updated Shopping Order Tracking Cluster.

In case of an error, the entire request is rejected and the existing state is maintained.

publishUserAccountManagementRequest

This API is used to publish a Sign In card . The signin action directs users to the app's sign in page so that the app can publish content (or provide more personalized content)

The following metadata is part of the Sign In Card -

صفت مورد نیاز توضیحات
Action Uri مورد نیاز Deeplink to Action (ie navigates to app sign in page)
تصویر Optional - If not provided, Title must be provided

Image Shown on the Card

16x9 aspect ratio images with a resolution of 1264x712

عنوان Optional - If not provided, Image must be provided Title on the Card
Action Text اختیاری Text Shown on the CTA (ie Sign in)
زیرنویس اختیاری Optional Subtitle on the Card

کاتلین

var SIGN_IN_CARD_ENTITY =
      SignInCardEntity.Builder()
          .addPosterImage(
              Image.Builder()
                  .setImageUri(Uri.parse("http://www.x.com/image.png"))
                  .setImageHeightInPixel(500)
                  .setImageWidthInPixel(500)
                  .build())
          .setActionText("Sign In")
          .setActionUri(Uri.parse("http://xx.com/signin"))
          .build()

client.publishUserAccountManagementRequest(
            PublishUserAccountManagementRequest.Builder()
                .setSignInCardEntity(SIGN_IN_CARD_ENTITY)
                .build());

جاوا

SignInCardEntity SIGN_IN_CARD_ENTITY =
      new SignInCardEntity.Builder()
          .addPosterImage(
              new Image.Builder()
                  .setImageUri(Uri.parse("http://www.x.com/image.png"))
                  .setImageHeightInPixel(500)
                  .setImageWidthInPixel(500)
                  .build())
          .setActionText("Sign In")
          .setActionUri(Uri.parse("http://xx.com/signin"))
          .build();

client.publishUserAccountManagementRequest(
            new PublishUserAccountManagementRequest.Builder()
                .setSignInCardEntity(SIGN_IN_CARD_ENTITY)
                .build());

When the service receives the request, the following actions take place within one transaction:

  • Existing UserAccountManagementCluster data from the developer partner is removed.
  • Data from the request is parsed and stored in the updated UserAccountManagementCluster Cluster.

In case of an error, the entire request is rejected and the existing state is maintained.

updatePublishStatus

If for any internal business reason, none of the clusters is published, we strongly recommend updating the publish status using the updatePublishStatus API. This is important because :

  • Providing the status in all scenarios, even when the content is published (STATUS == PUBLISHED), is critical to populate dashboards that use this explicit status to convey the health and other metrics of your integration.
  • If no content is published but the integration status isn't broken (STATUS == NOT_PUBLISHED), Google can avoid triggering alerts in the app health dashboards. It confirms that content is not published due to an expected situation from the provider's standpoint.
  • It helps developers provide insights into when the data is published versus not.
  • Google may use the status codes to nudge the user to do certain actions in the app so they can see the app content or overcome it.

The list of eligible publish status codes are :

// Content is published
AppEngagePublishStatusCode.PUBLISHED,

// Content is not published as user is not signed in
AppEngagePublishStatusCode.NOT_PUBLISHED_REQUIRES_SIGN_IN,

// Content is not published as user is not subscribed
AppEngagePublishStatusCode.NOT_PUBLISHED_REQUIRES_SUBSCRIPTION,

// Content is not published as user location is ineligible
AppEngagePublishStatusCode.NOT_PUBLISHED_INELIGIBLE_LOCATION,

// Content is not published as there is no eligible content
AppEngagePublishStatusCode.NOT_PUBLISHED_NO_ELIGIBLE_CONTENT,

// Content is not published as the feature is disabled by the client
// Available in v1.3.1
AppEngagePublishStatusCode.NOT_PUBLISHED_FEATURE_DISABLED_BY_CLIENT,

// Content is not published as the feature due to a client error
// Available in v1.3.1
AppEngagePublishStatusCode.NOT_PUBLISHED_CLIENT_ERROR,

// Content is not published as the feature due to a service error
// Available in v1.3.1
AppEngagePublishStatusCode.NOT_PUBLISHED_SERVICE_ERROR,

// Content is not published due to some other reason
// Reach out to engage-developers@ before using this enum.
AppEngagePublishStatusCode.NOT_PUBLISHED_OTHER

If the content is not published due to a user not logged in, Google would recommend publishing the Sign In Card. If for any reason providers are not able to publish the Sign In Card then we recommend calling the updatePublishStatus API with the status code NOT_PUBLISHED_REQUIRES_SIGN_IN

کاتلین

client.updatePublishStatus(
   PublishStatusRequest.Builder()
     .setStatusCode(AppEngagePublishStatusCode.NOT_PUBLISHED_REQUIRES_SIGN_IN)
     .build())

جاوا

client.updatePublishStatus(
    new PublishStatusRequest.Builder()
        .setStatusCode(AppEngagePublishStatusCode.NOT_PUBLISHED_REQUIRES_SIGN_IN)
        .build());

deleteRecommendationClusters

This API is used to delete the content of Recommendation Clusters.

کاتلین

client.deleteRecommendationClusters()

جاوا

client.deleteRecommendationClusters();

When the service receives the request, it removes the existing data from the Recommendation Clusters. In case of an error, the entire request is rejected and the existing state is maintained.

deleteFeaturedCluster

This API is used to delete the content of Featured Cluster.

کاتلین

client.deleteFeaturedCluster()

جاوا

client.deleteFeaturedCluster();

When the service receives the request, it removes the existing data from the Featured Cluster. In case of an error, the entire request is rejected and the existing state is maintained.

deleteShoppingCartCluster

This API is used to delete the content of Shopping Cart Cluster.

کاتلین

client.deleteShoppingCartCluster()

جاوا

client.deleteShoppingCartCluster();

When the service receives the request, it removes the existing data from the Shopping Cart Cluster. In case of an error, the entire request is rejected and the existing state is maintained.

deleteShoppingListCluster

This API is used to delete the content of Shopping List Cluster.

کاتلین

client.deleteShoppingListCluster()

جاوا

client.deleteShoppingListCluster();

When the service receives the request, it removes the existing data from the Shopping List Cluster. In case of an error, the entire request is rejected and the existing state is maintained.

deleteShoppingReorderCluster

This API is used to delete the content of Shopping Reorder Cluster.

کاتلین

client.deleteShoppingReorderCluster()

جاوا

client.deleteShoppingReorderCluster();

When the service receives the request, it removes the existing data from the Shopping Reorder Cluster. In case of an error, the entire request is rejected and the existing state is maintained.

deleteShoppingOrderTrackingCluster

This API is used to delete the content of Shopping Order Tracking Cluster.

کاتلین

client.deleteShoppingOrderTrackingCluster()

جاوا

client.deleteShoppingOrderTrackingCluster();

When the service receives the request, it removes the existing data from the Shopping Order Tracking Cluster. In case of an error, the entire request is rejected and the existing state is maintained.

deleteUserManagementCluster

This API is used to delete the content of UserAccountManagement Cluster.

کاتلین

client.deleteUserManagementCluster()

جاوا

client.deleteUserManagementCluster();

When the service receives the request, it removes the existing data from the UserAccountManagement Cluster. In case of an error, the entire request is rejected and the existing state is maintained.

deleteClusters

This API is used to delete the content of a given cluster type.

کاتلین

client.deleteClusters(
    DeleteClustersRequest.Builder()
      .addClusterType(ClusterType.TYPE_FEATURED)
      .addClusterType(ClusterType.TYPE_RECOMMENDATION)
      ...
      .build())

جاوا

client.deleteClusters(
            new DeleteClustersRequest.Builder()
                .addClusterType(ClusterType.TYPE_FEATURED)
                .addClusterType(ClusterType.TYPE_RECOMMENDATION)
                ...
                .build());

When the service receives the request, it removes the existing data from all clusters matching the specified cluster types. Clients can choose to pass one or many cluster types. In case of an error, the entire request is rejected and the existing state is maintained.

رسیدگی به خطا

It is highly recommended to listen to the task result from the publish APIs such that a follow-up action can be taken to recover and resubmit an successful task.

کاتلین

client.publishRecommendationClusters(
        PublishRecommendationClustersRequest.Builder()
          .addRecommendationCluster(..)
          .build())
      .addOnCompleteListener { task ->
        if (task.isSuccessful) {
          // do something
        } else {
          val exception = task.exception
          if (exception is AppEngageException) {
            @AppEngageErrorCode val errorCode = exception.errorCode
            if (errorCode == AppEngageErrorCode.SERVICE_NOT_FOUND) {
              // do something
            }
          }
        }
      }

جاوا

client.publishRecommendationClusters(
              new PublishRecommendationClustersRequest.Builder()
                  .addRecommendationCluster(...)
                  .build())
          .addOnCompleteListener(
              task -> {
                if (task.isSuccessful()) {
                  // do something
                } else {
                  Exception exception = task.getException();
                  if (exception instanceof AppEngageException) {
                    @AppEngageErrorCode
                    int errorCode = ((AppEngageException) exception).getErrorCode();
                    if (errorCode == AppEngageErrorCode.SERVICE_NOT_FOUND) {
                      // do something
                    }
                  }
                }
              });

The error is returned as an AppEngageException with the cause included as an error code.

کد خطا Error name توجه داشته باشید
1 SERVICE_NOT_FOUND The service is not available on the given device.
2 SERVICE_NOT_AVAILABLE The service is available on the given device, but it is not available at the time of the call (for example, it is explicitly disabled).
3 SERVICE_CALL_EXECUTION_FAILURE The task execution failed due to threading issues. In this case, it can be retried.
4 SERVICE_CALL_PERMISSION_DENIED The caller is not allowed to make the service call.
5 SERVICE_CALL_INVALID_ARGUMENT The request contains invalid data (for example, more than the allowed number of clusters).
6 SERVICE_CALL_INTERNAL There is an error on the service side.
7 SERVICE_CALL_RESOURCE_EXHAUSTED The service call is made too frequently.

Step 3: Handle broadcast intents

In addition to making publish content API calls through a job, it is also required to set up a BroadcastReceiver to receive the request for a content publish.

The goal of broadcast intents is mainly for app reactivation and forcing data sync. Broadcast intents are not designed to be sent very frequently. It is only triggered when the Engage Service determines the content might be stale (for example, a week old). That way, there is more confidence that the user can have a fresh content experience, even if the application has not been executed for a long period of time.

The BroadcastReceiver must be set up in the following two ways:

  • Dynamically register an instance of the BroadcastReceiver class using Context.registerReceiver() . This enables communication from applications that are still live in memory.

کاتلین

class AppEngageBroadcastReceiver : BroadcastReceiver(){
  // Trigger recommendation cluster publish when PUBLISH_RECOMMENDATION
  // broadcast is received
  // Trigger featured cluster publish when PUBLISH_FEATURED broadcast is
  // received
  // Trigger shopping cart cluster publish when PUBLISH_SHOPPING_CART broadcast
  // is received
  // Trigger shopping list cluster publish when PUBLISH_SHOPPING_LIST broadcast
  // is received
  // Trigger reorder cluster publish when PUBLISH_REORDER_CLUSTER broadcast is
  // received
  // Trigger shopping order tracking cluster publish when
  // PUBLISH_SHOPPING_ORDER_TRACKING_CLUSTER broadcast is received
}

fun registerBroadcastReceivers(context: Context){
  var  context = context
  context = context.applicationContext

// Register Recommendation Cluster Publish Intent
  context.registerReceiver(AppEngageBroadcastReceiver(),
                           IntentFilter(Intents.ACTION_PUBLISH_RECOMMENDATION))

// Register Featured Cluster Publish Intent
  context.registerReceiver(AppEngageBroadcastReceiver(),
                           IntentFilter(Intents.ACTION_PUBLISH_FEATURED))

// Register Shopping Cart Cluster Publish Intent
  context.registerReceiver(AppEngageBroadcastReceiver(),
                           IntentFilter(Intents.ACTION_PUBLISH_SHOPPING_CART))

// Register Shopping List Cluster Publish Intent
  context.registerReceiver(AppEngageBroadcastReceiver(),
                           IntentFilter(Intents.ACTION_PUBLISH_SHOPPING_LIST))

// Register Reorder Cluster Publish Intent
  context.registerReceiver(AppEngageBroadcastReceiver(),
                           IntentFilter(Intents.ACTION_PUBLISH_REORDER_CLUSTER))

// Register Shopping Order Tracking Cluster Publish Intent
  context.registerReceiver(AppEngageBroadcastReceiver(),
                           IntentFilter(Intents.ACTION_PUBLISH_SHOPPING_ORDER_TRACKING_CLUSTER))
}

جاوا

class AppEngageBroadcastReceiver extends BroadcastReceiver {
// Trigger recommendation cluster publish when PUBLISH_RECOMMENDATION broadcast
// is received

// Trigger featured cluster publish when PUBLISH_FEATURED broadcast is received

// Trigger shopping cart cluster publish when PUBLISH_SHOPPING_CART broadcast is
// received

// Trigger shopping list cluster publish when PUBLISH_SHOPPING_LIST broadcast is
// received

// Trigger reorder cluster publish when PUBLISH_REORDER_CLUSTER broadcast is
// received

// Trigger reorder cluster publish when PUBLISH_SHOPPING_ORDER_TRACKING_CLUSTER
// broadcast is received
}

public static void registerBroadcastReceivers(Context context) {

context = context.getApplicationContext();

// Register Recommendation Cluster Publish Intent
context.registerReceiver(new AppEngageBroadcastReceiver(),
new IntentFilter(com.google.android.engage.service.Intents.ACTION_PUBLISH_RECOMMENDATION));

// Register Featured Cluster Publish Intent
context.registerReceiver(new AppEngageBroadcastReceiver(),
new IntentFilter(com.google.android.engage.service.Intents.ACTION_PUBLISH_FEATURED));

// Register Shopping Cart Cluster Publish Intent
context.registerReceiver(new AppEngageBroadcastReceiver(),
new IntentFilter(com.google.android.engage.shopping.service.Intents.ACTION_PUBLISH_SHOPPING_CART));

// Register Shopping List Cluster Publish Intent
context.registerReceiver(new AppEngageBroadcastReceiver(),
new IntentFilter(com.google.android.engage.shopping.service.Intents.ACTION_PUBLISH_SHOPPING_LIST));

// Register Reorder Cluster Publish Intent
context.registerReceiver(new AppEngageBroadcastReceiver(),
new IntentFilter(com.google.android.engage.shopping.service.Intents.ACTION_PUBLISH_REORDER_CLUSTER));

// Register Shopping Order Tracking Cluster Publish Intent
context.registerReceiver(new AppEngageBroadcastReceiver(),
new IntentFilter(com.google.android.engage.shopping.service.Intents.ACTION_PUBLISH_SHOPPING_ORDER_TRACKING_CLUSTER));

}
  • Statically declare an implementation with the <receiver> tag in your AndroidManifest.xml file. This allows the application to receive broadcast intents when it is not running, and also allows the application to publish the content.
<application>
   <receiver
      android:name=".AppEngageBroadcastReceiver"
      android:exported="true"
      android:enabled="true">
      <intent-filter>
         <action android:name="com.google.android.engage.action.PUBLISH_RECOMMENDATION" />
      </intent-filter>
      <intent-filter>
         <action android:name="com.google.android.engage.action.PUBLISH_FEATURED" />
      </intent-filter>
      <intent-filter>
         <action android:name="com.google.android.engage.action.shopping.PUBLISH_SHOPPING_CART" />
      </intent-filter>
      <intent-filter>
         <action android:name="com.google.android.engage.action.shopping.PUBLISH_SHOPPING_LIST" />
      </intent-filter>
      <intent-filter>
         <action android:name="com.google.android.engage.action.shopping.PUBLISH_REORDER_CLUSTER" />
      </intent-filter>
      <intent-filter>
         <action android:name="com.google.android.engage.action.shopping.PUBLISH_SHOPPING_ORDER_TRACKING_CLUSTER" />
      </intent-filter>
   </receiver>
</application>

The following intents are sent by the service:

  • com.google.android.engage.action.PUBLISH_RECOMMENDATION It is recommended to start a publishRecommendationClusters call when this intent is received.
  • com.google.android.engage.action.PUBLISH_FEATURED It is recommended to start a publishFeaturedCluster call when this intent is received.
  • com.google.android.engage.action.shopping.PUBLISH_SHOPPING_CART It is recommended to start a publishShoppingCart call when this intent is received.
  • com.google.android.engage.action.shopping.PUBLISH_SHOPPING_LIST It is recommended to start a publishShoppingList call when this intent is received.
  • com.google.android.engage.action.shopping.PUBLISH_REORDER_CLUSTER It is recommended to start a publishReorderCluster call when this intent is received.
  • com.google.android.engage.action.shopping.PUBLISH_SHOPPING_ORDER_TRACKING_CLUSTER It is recommended to start a publishShoppingOrderTrackingCluster call when this intent is received.

Integration workflow

For a step-by-step guide on verifying your integration after it is complete, see Engage developer integration workflow .

سوالات متداول

See Engage SDK Frequently Asked Questions for FAQs.

تماس بگیرید

Contact engage-developers@google.com if there are any questions during the integration process. Our team replies as soon as possible.

مراحل بعدی

After completing this integration, your next steps are as follows:

  • Send an email to engage-developers@google.com and attach your integrated APK that is ready for testing by Google.
  • Google performs a verification and reviews internally to make sure the integration works as expected. If changes are needed, Google contacts you with any necessary details.
  • When testing is complete and no changes are needed, Google contacts you to notify you that you can start publishing the updated and integrated APK to the Play Store.
  • After Google has confirmed that your updated APK has been published to the Play Store, your Recommendation , Featured , Shopping Cart , Shopping List , Reorder Cluster and Shopping Order Tracking Cluster clusters may be published and visible to users.
،

Google is building an on-device surface that organizes users' apps by verticals and enables a new immersive experience for personalized app content consumption and discovery. This fullscreen experience provides developer partners with an opportunity to showcase their best rich content in a dedicated channel outside of their app.

This guide contains instructions for developer partners to integrate their shopping content, using the Engage SDK to populate both this new surface area and existing Google surfaces like Entertainment Space.

Integration detail

اصطلاحات

This integration includes the following five cluster types: Recommendation , Featured , Shopping Cart , Shopping List , Reorder and Shopping Order Tracking .

  • Recommendation clusters show personalized shopping suggestions from an individual developer partner. These recommendations can be personalized to the user or generalized (for example, trending items). Use these to surface products, events, sales, promos, subscriptions as you see fit.

    Your recommendations take the following structure:

    • Recommendation Cluster: A UI view that contains a group of recommendations from the same developer partner.

    • ShoppingEntity: An object representing a single item in a cluster.

  • The Featured cluster showcases a selection of entities from multiple developer partners in one UI grouping. There will be a single Featured cluster, which is surfaced near the top of the UI with a priority placement above all Recommendation clusters. Each developer partner will be allowed to broadcast up to 10 entities in the Featured cluster.

  • The Shopping Cart cluster shows a sneak peek of shopping carts from many developer partners in one UI grouping, nudging users to complete their outstanding carts. There is a single Shopping Cart cluster, which is surfaced near the top of the UI, with a priority placement above all Recommendation clusters. Each developer partner is allowed to broadcast up to 3 ShoppingCart instances in the Shopping Cart cluster.

    Your Shopping Cart takes the following structure:

    • Shopping Cart Cluster: A UI view that contains a group of shopping cart previews from many developer partners.

    • ShoppingCart: An object representing the shopping cart preview for a single developer partner, to be displayed in the Shopping Cart cluster. The ShoppingCart must show the total count of items in the cart and may also include images for some items in the user's cart.

  • The Shopping List cluster shows a sneak peek of the shopping lists from multiple developer partners in one UI grouping, prompting users to return to the corresponding app to update and complete their lists. There is a single Shopping List cluster.

  • The Reorder cluster shows a sneak peek of the previous orders from multiple developer partners in one UI grouping, prompting users to reorder. There is a single Reorder cluster.

    • Reorder cluster must show the total count of items in the user's previous order and must also include one of the following:

      • Images for X items in the user's previous order.
      • Labels for X items in the user's previous order.
  • The Shopping Order Tracking cluster shows a sneak peek of pending or recently completed shopping orders from many developer partners in one UI grouping, allowing users to track their orders.

    There is a single ShoppingOrderTracking cluster that is surfaced near the top of the UI, with a priority placement above all Recommendation clusters. Each developer partner is allowed to broadcast multiple ShoppingOrderTrackingEntity items in the Shopping Order Tracking cluster.

    • Your ShoppingOrderTrackingCluster takes the following structure:

      • ShoppingOrderTracking Cluster : A UI view that contains a group of order tracking previews from many developer partners
      • ShoppingOrderTrackingEntity : An object representing a shopping order tracking preview for a single developer partner, to be displayed in the Shopping Order Tracking cluster. The ShoppingOrderTrackingEntity must show the status of the order and the order time. We strongly recommend populating the expected delivery time for ShoppingOrderTrackingEntity, as it's displayed to users when provided.

Pre-work

Minimum API level: 19

Add the com.google.android.engage:engage-core library to your app:

dependencies {
    // Make sure you also include that repository in your project's build.gradle file.
    implementation 'com.google.android.engage:engage-core:1.5.2'
}

For more information, see Package visibility in Android 11 .

خلاصه

The design is based on an implementation of a bound service .

The data a client can publish is subject to the following limits for different cluster types:

Cluster type Cluster limits Maximum entity limits in a cluster
Recommendation Cluster(s) At most 7 At most 50 ShoppingEntity
Featured Cluster حداکثر 1 At most 20 ShoppingEntity
Shopping Cart Cluster حداکثر 1 At most 3 ShoppingCart

Multiple carts only expected for apps with separate carts per merchant.

Shopping List Cluster حداکثر 1 At most 1 ShoppingListEntity
Shopping Reorder Cluster حداکثر 1 At most 1 ReorderEntity
Shopping Order Tracking Cluster حداکثر 3 At most 3 ShoppingOrderTrackingEntity

Step 1: Provide entity data

The SDK has defined different entities to represent each item type. The following entities are supported for the Shopping category:

  1. ShoppingEntity
  2. ShoppingCart
  3. ShoppingList
  4. Reorder
  5. ShoppingOrderTracking

The charts below outline available attributes and requirements for each type.

ShoppingEntity

The ShoppingEntity object represents a product, promotion, deal, subscription, or event that developer partners want to publish.

ShoppingEntity
صفت مورد نیاز توضیحات قالب
Poster images مورد نیاز At least one image must be provided. See Image Specifications for guidance.
Action Uri مورد نیاز

The deep link to the page in the app displaying details about the entity.

Note: You can use deep links for attribution. Refer to this FAQ

اوری
عنوان اختیاری The name of the entity.

متن رایگان

Recommended text size: under 90 chars (Text that is too long may show ellipses)

Price - current Conditionally required

The current price of the entity.

Must be provided if strikethrough price is provided.

متن رایگان
Price - strikethrough اختیاری The original price of the entity, which is be struck-through in the UI. متن رایگان
فراخوانی اختیاری Callout to feature a promo, event, or update for the entity, if available.

متن رایگان

Recommended text size: under 45 chars (Text that is too long may show ellipses)

Callout fine print اختیاری Fine print text for the callout.

متن رایگان

Recommended text size: under 45 chars (Text that is too long may show ellipses)

Rating (Optional) - Note: All ratings are displayed using our standard star rating system.
Rating - Max value اختیاری

The maximum value of the rating scale.

Must be provided if current value of rating is also provided.

Number >= 0.0
Rating - Current value اختیاری

The current value of the rating scale.

Must be provided if maximum value of rating is also provided.

Number >= 0.0
Rating - Count اختیاری

The count of the ratings for the entity.

Note: Provide this field if your app controls how the count is displayed to the users. Use a concise string. For example, if the count is 1,000,000, consider using an abbreviation like 1M so that the count isn't truncated on smaller display sizes.

رشته
Rating - Count Value اختیاری

The count of the ratings for the entity.

Note: Provide this field if you don't handle the display abbreviation logic yourself. If both Count and Count Value are present, Count is displayed to users.

طولانی
DisplayTimeWindow (Optional) - Set a time window for a content to be shown on the surface
Start Timestamp اختیاری

The epoch timestamp after which the content should be shown on the surface.

If not set, content is eligible to be shown on the surface.

Epoch timestamp in milliseconds
End Timestamp اختیاری

The epoch timestamp after which the content is no longer shown on the surface.

If not set, content is eligible to be shown on the surface.

Epoch timestamp in milliseconds

ShoppingCart

صفت مورد نیاز توضیحات قالب
Action Uri مورد نیاز

The deep link to the shopping cart in the partner's app.

Note: You can use deep links for attribution. Refer to this FAQ

اوری
تعداد اقلام مورد نیاز

The number of items (not just number of products) in the shopping cart.

For example: If there are 3 identical shirts and 1 hat in the cart, this number should be 4.

Integer >= 1
Action Text اختیاری

The call to action text of the button on the Shopping Cart (for example, Your Shopping Bag ).

If no action text is provided by the developer, View Cart is the default.

This attribute is supported in version 1.1.0 onwards.

رشته
عنوان اختیاری

The title of the cart (for example, Your Shopping Bag ).

If no title is provided by the developer, Your cart is the default.

If developer partner publishes a separate cart per merchant, please include merchant name in the title.

متن رایگان

Recommended text size: under 25 chars (Text that is too long may show ellipses)

Cart images اختیاری

Images of each product in the cart.

Up to 10 images can be provided in order of priority; the actual number of images displayed depends on the device form factor.

See Image Specifications for guidance.
Item labels اختیاری

The list of labels for items on the shopping list.

The actual number of labels displayed depends on the device form factor.

List of free text labels

Recommended text size: under 20 chars (Text that is too long may show ellipses)

Last user interaction timestamp اختیاری Number of milliseconds elapsed from the epoch, identifying the last time when user interacted with the cart.

This will be passed as input by the developer partners publishing separate cart per merchant and maybe used for ranking.

Epoch timestamp in milliseconds
DisplayTimeWindow (Optional) - Set a time window for a content to be shown on the surface
Start Timestamp اختیاری

The epoch timestamp after which the content should be shown on the surface.

If not set, content is eligible to be shown on the surface.

Epoch timestamp in milliseconds
End Timestamp اختیاری

The epoch timestamp after which the content is no longer shown on the surface.

If not set, content is eligible to be shown on the surface.

Epoch timestamp in milliseconds

ShoppingList

صفت مورد نیاز توضیحات قالب
Action Uri مورد نیاز

The deep link to the shopping list in the partner's app.

Note: You can use deep links for attribution. Refer to this FAQ

اوری
تعداد اقلام مورد نیاز The number of items in the shopping list. Integer >= 1
عنوان اختیاری

The title of the list (for example, Your Grocery List ).

If no title is provided by the developer, Shopping list is the default.

متن رایگان

Recommended text size: under 25 chars (Text that is too long may show ellipses)

Item labels مورد نیاز

The list of labels for items on the shopping list.

At least 1 label must be provided and up to 10 labels can be provided in order of priority; the actual number of labels displayed depends on the device form factor.

List of free text labels

Recommended text size: under 20 chars (Text that is too long may show ellipses)

ShoppingReorderCluster

صفت مورد نیاز توضیحات قالب
Action Uri مورد نیاز

The deep link to reorder in the partner's app.

Note: You can use deep links for attribution. Refer to this FAQ

اوری
Action Text اختیاری

The call to action text of the button on the Reorder (for example, Order again ).

If no action text is provided by the developer, Reorder is the default.

This attribute is supported in version 1.1.0 onwards.

رشته
تعداد اقلام مورد نیاز

The number of items (not just number of products) in the previous order.

For example: If there were 3 small coffees and 1 croissant in the previous order, this number should be 4.

Integer >= 1
عنوان مورد نیاز The title of the reorder item.

متن رایگان

Recommended text size: under 40 chars (Text that is too long may show ellipses)

Item labels

اختیاری

(If not provided, poster images should be provided)

The list of item labels for the previous order.

Up to 10 labels can be provided in order of priority; the actual number of labels displayed depends on the device form factor.

List of free text

Recommended text size per label: under 20 chars (Text that is too long may show ellipses)

Poster images

اختیاری

(If not provided, item labels should be provided)

Images of the items in the previous order.

Up to 10 images can be provided in order of priority; the actual number of images displayed depends on the device form factor.

See Image Specifications for guidance.

ShoppingOrderTrackingCluster

صفت مورد نیاز توضیحات قالب
عنوان مورد نیاز

A short title of the package/items being tracked or the tracking number.

متن رایگان

Recommended text size: 50 chars (Text that is too long will show ellipses)

نوع سفارش مورد نیاز

A short title of the package/items being tracked or the tracking number.

Enum: IN_STORE_PICKUP, SAME_DAY_DELIVERY, MULTI_DAY_DELIVERY

وضعیت مورد نیاز

The current status of the order.

For example: "Running late", "In transit", "Delayed", "Shipped", "Delivered", "Out of stock", "Order ready"

متن رایگان

Recommended text size: 25 chars (Text that is too long will show ellipses)

زمان سفارش مورد نیاز

The epoch timestamp in milliseconds at which the order was placed.

Order time will be displayed if expected delivery time window is not present

Epoch timestamp in milliseconds
Action Uri مورد نیاز

Deep link to the order tracking in the partner's app.

اوری
OrderDeliveryTimeWindow (Optional) - Set a time window for the order that is being tracked from the time the order was placed to the time of expected/actual delivery.
OrderDeliveryTimeWindow - Start Time اختیاری

The epoch timestamp in milliseconds on/after which the order will be delivered or be ready for pickup.

Epoch timestamp in milliseconds
OrderDeliveryTimeWindow - End Time اختیاری

The epoch timestamp in milliseconds on/before which the order will be delivered or be ready for pickup.

Epoch timestamp in milliseconds
Poster images اختیاری

Image of one item/product that is part of the order.

Recommended aspect ratio is 1:1

See Image Specifications for guidance.
تعداد اقلام اختیاری The number of items in the order. Integer >= 1
توضیحات اختیاری

A single paragraph of text to describe the items in the order.

Note: Either description or subtitle list will be displayed to the user, not both.

متن رایگان

Recommended text size: 180 chars

Subtitle list اختیاری

Up to 3 subtitles, with each subtitle a single line of text.

Note: Either description or subtitle list will be displayed to the user, not both.

متن رایگان

Recommended text size for each subtitle: max 50 chars

Order Value - CurrentPrice اختیاری The current value of the order. متن رایگان
شماره سفارش اختیاری The order number/ID that can be used to uniquely identify the order.

متن رایگان

Recommended text size: max 25 chars

شماره پیگیری اختیاری The tracking number for the order/parcel delivery in case the order requires a delivery.

متن رایگان

Recommended text size: max 25 chars

مشخصات تصویر

Required specifications for image assets are listed below:

نسبت ابعاد Minimum pixels Recommended pixels

Square (1x1)

Preferred for non featured clusters

300x300 1200x1200

Landscape (1.91x1)

Preferred for featured clusters

600x314 1200x628
Portrait (4x5) 480x600 960x1200

فرمت های فایل

PNG, JPG, static GIF, WebP

حداکثر اندازه فایل

5120 KB

توصیه های اضافی

  • Image safe area: Put your important content in the center 80% of the image.
  • Use a transparent background so that the image can be properly displayed in Dark and Light theme settings.

Step 2: Provide Cluster data

It is recommended to have the content publish job executed in the background (for example, using WorkManager ) and scheduled on a regular basis or on an event basis (for example, every time the user opens the app or when the user just added something to their cart).

AppEngageShoppingClient is responsible for publishing shopping clusters.

Following APIs are exposed to publish clusters in the client:

  • isServiceAvailable
  • publishRecommendationClusters
  • publishFeaturedCluster
  • publishShoppingCart
  • publishShoppingCarts
  • publishShoppingList
  • publishShoppingReorderCluster
  • publishShoppingOrderTrackingCluster
  • publishUserAccountManagementRequest
  • updatePublishStatus
  • deleteRecommendationsClusters
  • deleteFeaturedCluster
  • deleteShoppingCartCluster
  • deleteShoppingListCluster
  • deleteShoppingReorderCluster
  • deleteShoppingOrderTrackingCluster
  • deleteUserManagementCluster
  • deleteClusters

isServiceAvailable

This API is used to check if the service is available for integration and whether the content can be presented on the device.

کاتلین

client.isServiceAvailable.addOnCompleteListener { task ->
    if (task.isSuccessful) {
        // Handle IPC call success
        if(task.result) {
          // Service is available on the device, proceed with content publish
          // calls.
        } else {
          // Service is not available, no further action is needed.
        }
    } else {
      // The IPC call itself fails, proceed with error handling logic here,
      // such as retry.
    }
}

جاوا

client.isServiceAvailable().addOnCompleteListener(task - > {
    if (task.isSuccessful()) {
        // Handle success
        if(task.getResult()) {
          // Service is available on the device, proceed with content
          // publish calls.
        } else {
          // Service is not available, no further action is needed.
        }
    } else {
      // The IPC call itself fails, proceed with error handling logic here,
      // such as retry.
    }
});

publishRecommendationClusters

This API is used to publish a list of RecommendationCluster objects.

A RecommendationCluster object can have the following attributes:

صفت مورد نیاز توضیحات
List of ShoppingEntity مورد نیاز A list of ShoppingEntity objects that make up the recommendations for this Recommendation Cluster.
عنوان مورد نیاز

The title for the Recommendation Cluster.

Recommended text size: under 25 chars (Text that is too long may show ellipses)

زیرنویس اختیاری The subtitle for the Recommendation Cluster.
Action Uri اختیاری

The deep link to the page in the partner app where users can see the complete list of recommendations.

Note: You can use deep links for attribution. Refer to this FAQ

کاتلین

client.publishRecommendationClusters(
            PublishRecommendationClustersRequest.Builder()
                .addRecommendationCluster(
                    RecommendationCluster.Builder()
                        .addEntity(entity1)
                        .addEntity(entity2)
                        .setTitle("Black Friday Deals")
                        .build())
                .build())

جاوا

client.publishRecommendationClusters(
            new PublishRecommendationClustersRequest.Builder()
                .addRecommendationCluster(
                    new RecommendationCluster.Builder()
                        .addEntity(entity1)
                        .addEntity(entity2)
                        .setTitle("Black Friday Deals")
                        .build())
                .build());

When the service receives the request, the following actions take place within one transaction:

  • All existing Recommendation Cluster data is removed.
  • Data from the request is parsed and stored in new Recommendation Clusters.

In case of an error, the entire request is rejected and the existing state is maintained.

publishFeaturedCluster

This API is used to publish a FeaturedCluster object.

کاتلین

client.publishFeaturedCluster(
            PublishFeaturedClusterRequest.Builder()
                .setFeaturedCluster(
                    FeaturedCluster.Builder()
                        ...
                        .build())
                .build())

جاوا

client.publishFeaturedCluster(
            new PublishFeaturedClusterRequest.Builder()
                .setFeaturedCluster(
                    new FeaturedCluster.Builder()
                        ...
                        .build())
                .build());

When the service receives the request, the following actions take place within one transaction:

  • Existing FeaturedCluster data from the developer partner is removed.
  • Data from the request is parsed and stored in the updated Featured Cluster.

In case of an error, the entire request is rejected and the existing state is maintained.

publishShoppingCart

This API is used to publish a ShoppingCartCluster object.

کاتلین

client.publishShoppingCart(
            PublishShoppingCartRequest.Builder()
                .setShoppingCart(
                    ShoppingCart.Builder()
                        ...
                        .build())
                .build())

جاوا

client.publishShoppingCart(
            new PublishShoppingCartRequest.Builder()
                .setShoppingCart(
                    new ShoppingCart.Builder()
                        ...
                        .build())
                .build())

When the service receives the request, the following actions take place within one transaction:

  • Existing ShoppingCart data from the developer partner is removed.
  • Data from the request is parsed and stored in the updated Shopping Cart Cluster.

In case of an error, the entire request is rejected and the existing state is maintained.

publishShoppingCarts

This API is used to publish multiple ShoppingCart objects. This is applicable to developer partner publishing separate carts per merchant. Include merchant name in the title when using this API.

کاتلین

client.publishShoppingCarts(
            PublishShoppingCartClustersRequest.Builder()
                .addShoppingCart(
                    ShoppingCart.Builder()
                        ...
                        .build())
                .build())

جاوا

client.publishShoppingCarts(
            new PublishShoppingCartClustersRequest.Builder()
                .addShoppingCart(
                    new ShoppingCart.Builder()
                        ...
                        .build())
                .build())

When the service receives the request, the following actions take place within one transaction:

  • Existing ShoppingCart data from the developer partner is removed.
  • Data from the request is parsed and stored in the updated Shopping Cart Cluster.

In case of an error, the entire request is rejected and the existing state is maintained.

publishShoppingList

This API is used to publish a FoodShoppingList object.

کاتلین

client.publishFoodShoppingList(
            PublishFoodShoppingListRequest.Builder()
                .setFoodShoppingList(
                    FoodShoppingListEntity.Builder()
                        ...
                        .build())
                .build())

جاوا

client.publishFoodShoppingList(
            new PublishFoodShoppingListRequest.Builder()
                .setFoodShoppingList(
                    new FoodShoppingListEntity.Builder()
                        ...
                        .build())
                .build());

When the service receives the request, the following actions take place within one transaction:

  • Existing FoodShoppingList data from the developer partner is removed.
  • Data from the request is parsed and stored in the updated Shopping List Cluster.

In case of an error, the entire request is rejected and the existing state is maintained.

publishShoppingReorderCluster

This API is used to publish a ShoppingReorderCluster object.

کاتلین

client.publishShoppingReorderCluster(
            PublishShoppingReorderClusterRequest.Builder()
                .setReorderCluster(
                    ShoppingReorderCluster.Builder()
                        ...
                        .build())
                .build())

جاوا

client.publishShoppingReorderCluster(
            new PublishShoppingReorderClusterRequest.Builder()
                .setReorderCluster(
                    new ShoppingReorderCluster.Builder()
                        ...
                        .build())
                .build());

When the service receives the request, the following actions take place within one transaction:

  • Existing ShoppingReorderCluster data from the developer partner is removed.
  • Data from the request is parsed and stored in the updated Reorder Cluster.

In case of an error, the entire request is rejected and the existing state is maintained.

publishShoppingOrderTrackingCluster

This API is used to publish a ShoppingOrderTrackingCluster object.

کاتلین

client.publishShoppingOrderTrackingCluster(
            PublishShoppingOrderTrackingClusterRequest.Builder()
                .setShoppingOrderTrackingCluster(
                    ShoppingOrderTrackingCluster.Builder()
                        ...
                        .build())
                .build())

جاوا

client.publishShoppingOrderTrackingCluster(
            new PublishShoppingOrderTrackingClusterRequest.Builder()
                .setShoppingOrderTrackingCluster(
                    new ShoppingOrderTrackingCluster.Builder()
                        ...
                        .build())
                .build());

When the service receives the request, the following actions take place within one transaction:

  • Existing ShoppingOrderTrackingCluster data from the developer partner is removed.
  • Data from the request is parsed and stored in the updated Shopping Order Tracking Cluster.

In case of an error, the entire request is rejected and the existing state is maintained.

publishUserAccountManagementRequest

This API is used to publish a Sign In card . The signin action directs users to the app's sign in page so that the app can publish content (or provide more personalized content)

The following metadata is part of the Sign In Card -

صفت مورد نیاز توضیحات
Action Uri مورد نیاز Deeplink to Action (ie navigates to app sign in page)
تصویر Optional - If not provided, Title must be provided

Image Shown on the Card

16x9 aspect ratio images with a resolution of 1264x712

عنوان Optional - If not provided, Image must be provided Title on the Card
Action Text اختیاری Text Shown on the CTA (ie Sign in)
زیرنویس اختیاری Optional Subtitle on the Card

کاتلین

var SIGN_IN_CARD_ENTITY =
      SignInCardEntity.Builder()
          .addPosterImage(
              Image.Builder()
                  .setImageUri(Uri.parse("http://www.x.com/image.png"))
                  .setImageHeightInPixel(500)
                  .setImageWidthInPixel(500)
                  .build())
          .setActionText("Sign In")
          .setActionUri(Uri.parse("http://xx.com/signin"))
          .build()

client.publishUserAccountManagementRequest(
            PublishUserAccountManagementRequest.Builder()
                .setSignInCardEntity(SIGN_IN_CARD_ENTITY)
                .build());

جاوا

SignInCardEntity SIGN_IN_CARD_ENTITY =
      new SignInCardEntity.Builder()
          .addPosterImage(
              new Image.Builder()
                  .setImageUri(Uri.parse("http://www.x.com/image.png"))
                  .setImageHeightInPixel(500)
                  .setImageWidthInPixel(500)
                  .build())
          .setActionText("Sign In")
          .setActionUri(Uri.parse("http://xx.com/signin"))
          .build();

client.publishUserAccountManagementRequest(
            new PublishUserAccountManagementRequest.Builder()
                .setSignInCardEntity(SIGN_IN_CARD_ENTITY)
                .build());

When the service receives the request, the following actions take place within one transaction:

  • Existing UserAccountManagementCluster data from the developer partner is removed.
  • Data from the request is parsed and stored in the updated UserAccountManagementCluster Cluster.

In case of an error, the entire request is rejected and the existing state is maintained.

updatePublishStatus

If for any internal business reason, none of the clusters is published, we strongly recommend updating the publish status using the updatePublishStatus API. This is important because :

  • Providing the status in all scenarios, even when the content is published (STATUS == PUBLISHED), is critical to populate dashboards that use this explicit status to convey the health and other metrics of your integration.
  • If no content is published but the integration status isn't broken (STATUS == NOT_PUBLISHED), Google can avoid triggering alerts in the app health dashboards. It confirms that content is not published due to an expected situation from the provider's standpoint.
  • It helps developers provide insights into when the data is published versus not.
  • Google may use the status codes to nudge the user to do certain actions in the app so they can see the app content or overcome it.

The list of eligible publish status codes are :

// Content is published
AppEngagePublishStatusCode.PUBLISHED,

// Content is not published as user is not signed in
AppEngagePublishStatusCode.NOT_PUBLISHED_REQUIRES_SIGN_IN,

// Content is not published as user is not subscribed
AppEngagePublishStatusCode.NOT_PUBLISHED_REQUIRES_SUBSCRIPTION,

// Content is not published as user location is ineligible
AppEngagePublishStatusCode.NOT_PUBLISHED_INELIGIBLE_LOCATION,

// Content is not published as there is no eligible content
AppEngagePublishStatusCode.NOT_PUBLISHED_NO_ELIGIBLE_CONTENT,

// Content is not published as the feature is disabled by the client
// Available in v1.3.1
AppEngagePublishStatusCode.NOT_PUBLISHED_FEATURE_DISABLED_BY_CLIENT,

// Content is not published as the feature due to a client error
// Available in v1.3.1
AppEngagePublishStatusCode.NOT_PUBLISHED_CLIENT_ERROR,

// Content is not published as the feature due to a service error
// Available in v1.3.1
AppEngagePublishStatusCode.NOT_PUBLISHED_SERVICE_ERROR,

// Content is not published due to some other reason
// Reach out to engage-developers@ before using this enum.
AppEngagePublishStatusCode.NOT_PUBLISHED_OTHER

If the content is not published due to a user not logged in, Google would recommend publishing the Sign In Card. If for any reason providers are not able to publish the Sign In Card then we recommend calling the updatePublishStatus API with the status code NOT_PUBLISHED_REQUIRES_SIGN_IN

کاتلین

client.updatePublishStatus(
   PublishStatusRequest.Builder()
     .setStatusCode(AppEngagePublishStatusCode.NOT_PUBLISHED_REQUIRES_SIGN_IN)
     .build())

جاوا

client.updatePublishStatus(
    new PublishStatusRequest.Builder()
        .setStatusCode(AppEngagePublishStatusCode.NOT_PUBLISHED_REQUIRES_SIGN_IN)
        .build());

deleteRecommendationClusters

This API is used to delete the content of Recommendation Clusters.

کاتلین

client.deleteRecommendationClusters()

جاوا

client.deleteRecommendationClusters();

When the service receives the request, it removes the existing data from the Recommendation Clusters. In case of an error, the entire request is rejected and the existing state is maintained.

deleteFeaturedCluster

This API is used to delete the content of Featured Cluster.

کاتلین

client.deleteFeaturedCluster()

جاوا

client.deleteFeaturedCluster();

When the service receives the request, it removes the existing data from the Featured Cluster. In case of an error, the entire request is rejected and the existing state is maintained.

deleteShoppingCartCluster

This API is used to delete the content of Shopping Cart Cluster.

کاتلین

client.deleteShoppingCartCluster()

جاوا

client.deleteShoppingCartCluster();

When the service receives the request, it removes the existing data from the Shopping Cart Cluster. In case of an error, the entire request is rejected and the existing state is maintained.

deleteShoppingListCluster

This API is used to delete the content of Shopping List Cluster.

کاتلین

client.deleteShoppingListCluster()

جاوا

client.deleteShoppingListCluster();

When the service receives the request, it removes the existing data from the Shopping List Cluster. In case of an error, the entire request is rejected and the existing state is maintained.

deleteShoppingReorderCluster

This API is used to delete the content of Shopping Reorder Cluster.

کاتلین

client.deleteShoppingReorderCluster()

جاوا

client.deleteShoppingReorderCluster();

When the service receives the request, it removes the existing data from the Shopping Reorder Cluster. In case of an error, the entire request is rejected and the existing state is maintained.

deleteShoppingOrderTrackingCluster

This API is used to delete the content of Shopping Order Tracking Cluster.

کاتلین

client.deleteShoppingOrderTrackingCluster()

جاوا

client.deleteShoppingOrderTrackingCluster();

When the service receives the request, it removes the existing data from the Shopping Order Tracking Cluster. In case of an error, the entire request is rejected and the existing state is maintained.

deleteUserManagementCluster

This API is used to delete the content of UserAccountManagement Cluster.

کاتلین

client.deleteUserManagementCluster()

جاوا

client.deleteUserManagementCluster();

When the service receives the request, it removes the existing data from the UserAccountManagement Cluster. In case of an error, the entire request is rejected and the existing state is maintained.

deleteClusters

This API is used to delete the content of a given cluster type.

کاتلین

client.deleteClusters(
    DeleteClustersRequest.Builder()
      .addClusterType(ClusterType.TYPE_FEATURED)
      .addClusterType(ClusterType.TYPE_RECOMMENDATION)
      ...
      .build())

جاوا

client.deleteClusters(
            new DeleteClustersRequest.Builder()
                .addClusterType(ClusterType.TYPE_FEATURED)
                .addClusterType(ClusterType.TYPE_RECOMMENDATION)
                ...
                .build());

When the service receives the request, it removes the existing data from all clusters matching the specified cluster types. Clients can choose to pass one or many cluster types. In case of an error, the entire request is rejected and the existing state is maintained.

رسیدگی به خطا

It is highly recommended to listen to the task result from the publish APIs such that a follow-up action can be taken to recover and resubmit an successful task.

کاتلین

client.publishRecommendationClusters(
        PublishRecommendationClustersRequest.Builder()
          .addRecommendationCluster(..)
          .build())
      .addOnCompleteListener { task ->
        if (task.isSuccessful) {
          // do something
        } else {
          val exception = task.exception
          if (exception is AppEngageException) {
            @AppEngageErrorCode val errorCode = exception.errorCode
            if (errorCode == AppEngageErrorCode.SERVICE_NOT_FOUND) {
              // do something
            }
          }
        }
      }

جاوا

client.publishRecommendationClusters(
              new PublishRecommendationClustersRequest.Builder()
                  .addRecommendationCluster(...)
                  .build())
          .addOnCompleteListener(
              task -> {
                if (task.isSuccessful()) {
                  // do something
                } else {
                  Exception exception = task.getException();
                  if (exception instanceof AppEngageException) {
                    @AppEngageErrorCode
                    int errorCode = ((AppEngageException) exception).getErrorCode();
                    if (errorCode == AppEngageErrorCode.SERVICE_NOT_FOUND) {
                      // do something
                    }
                  }
                }
              });

The error is returned as an AppEngageException with the cause included as an error code.

کد خطا Error name توجه داشته باشید
1 SERVICE_NOT_FOUND The service is not available on the given device.
2 SERVICE_NOT_AVAILABLE The service is available on the given device, but it is not available at the time of the call (for example, it is explicitly disabled).
3 SERVICE_CALL_EXECUTION_FAILURE The task execution failed due to threading issues. In this case, it can be retried.
4 SERVICE_CALL_PERMISSION_DENIED The caller is not allowed to make the service call.
5 SERVICE_CALL_INVALID_ARGUMENT The request contains invalid data (for example, more than the allowed number of clusters).
6 SERVICE_CALL_INTERNAL There is an error on the service side.
7 SERVICE_CALL_RESOURCE_EXHAUSTED The service call is made too frequently.

Step 3: Handle broadcast intents

In addition to making publish content API calls through a job, it is also required to set up a BroadcastReceiver to receive the request for a content publish.

The goal of broadcast intents is mainly for app reactivation and forcing data sync. Broadcast intents are not designed to be sent very frequently. It is only triggered when the Engage Service determines the content might be stale (for example, a week old). That way, there is more confidence that the user can have a fresh content experience, even if the application has not been executed for a long period of time.

The BroadcastReceiver must be set up in the following two ways:

  • Dynamically register an instance of the BroadcastReceiver class using Context.registerReceiver() . This enables communication from applications that are still live in memory.

کاتلین

class AppEngageBroadcastReceiver : BroadcastReceiver(){
  // Trigger recommendation cluster publish when PUBLISH_RECOMMENDATION
  // broadcast is received
  // Trigger featured cluster publish when PUBLISH_FEATURED broadcast is
  // received
  // Trigger shopping cart cluster publish when PUBLISH_SHOPPING_CART broadcast
  // is received
  // Trigger shopping list cluster publish when PUBLISH_SHOPPING_LIST broadcast
  // is received
  // Trigger reorder cluster publish when PUBLISH_REORDER_CLUSTER broadcast is
  // received
  // Trigger shopping order tracking cluster publish when
  // PUBLISH_SHOPPING_ORDER_TRACKING_CLUSTER broadcast is received
}

fun registerBroadcastReceivers(context: Context){
  var  context = context
  context = context.applicationContext

// Register Recommendation Cluster Publish Intent
  context.registerReceiver(AppEngageBroadcastReceiver(),
                           IntentFilter(Intents.ACTION_PUBLISH_RECOMMENDATION))

// Register Featured Cluster Publish Intent
  context.registerReceiver(AppEngageBroadcastReceiver(),
                           IntentFilter(Intents.ACTION_PUBLISH_FEATURED))

// Register Shopping Cart Cluster Publish Intent
  context.registerReceiver(AppEngageBroadcastReceiver(),
                           IntentFilter(Intents.ACTION_PUBLISH_SHOPPING_CART))

// Register Shopping List Cluster Publish Intent
  context.registerReceiver(AppEngageBroadcastReceiver(),
                           IntentFilter(Intents.ACTION_PUBLISH_SHOPPING_LIST))

// Register Reorder Cluster Publish Intent
  context.registerReceiver(AppEngageBroadcastReceiver(),
                           IntentFilter(Intents.ACTION_PUBLISH_REORDER_CLUSTER))

// Register Shopping Order Tracking Cluster Publish Intent
  context.registerReceiver(AppEngageBroadcastReceiver(),
                           IntentFilter(Intents.ACTION_PUBLISH_SHOPPING_ORDER_TRACKING_CLUSTER))
}

جاوا

class AppEngageBroadcastReceiver extends BroadcastReceiver {
// Trigger recommendation cluster publish when PUBLISH_RECOMMENDATION broadcast
// is received

// Trigger featured cluster publish when PUBLISH_FEATURED broadcast is received

// Trigger shopping cart cluster publish when PUBLISH_SHOPPING_CART broadcast is
// received

// Trigger shopping list cluster publish when PUBLISH_SHOPPING_LIST broadcast is
// received

// Trigger reorder cluster publish when PUBLISH_REORDER_CLUSTER broadcast is
// received

// Trigger reorder cluster publish when PUBLISH_SHOPPING_ORDER_TRACKING_CLUSTER
// broadcast is received
}

public static void registerBroadcastReceivers(Context context) {

context = context.getApplicationContext();

// Register Recommendation Cluster Publish Intent
context.registerReceiver(new AppEngageBroadcastReceiver(),
new IntentFilter(com.google.android.engage.service.Intents.ACTION_PUBLISH_RECOMMENDATION));

// Register Featured Cluster Publish Intent
context.registerReceiver(new AppEngageBroadcastReceiver(),
new IntentFilter(com.google.android.engage.service.Intents.ACTION_PUBLISH_FEATURED));

// Register Shopping Cart Cluster Publish Intent
context.registerReceiver(new AppEngageBroadcastReceiver(),
new IntentFilter(com.google.android.engage.shopping.service.Intents.ACTION_PUBLISH_SHOPPING_CART));

// Register Shopping List Cluster Publish Intent
context.registerReceiver(new AppEngageBroadcastReceiver(),
new IntentFilter(com.google.android.engage.shopping.service.Intents.ACTION_PUBLISH_SHOPPING_LIST));

// Register Reorder Cluster Publish Intent
context.registerReceiver(new AppEngageBroadcastReceiver(),
new IntentFilter(com.google.android.engage.shopping.service.Intents.ACTION_PUBLISH_REORDER_CLUSTER));

// Register Shopping Order Tracking Cluster Publish Intent
context.registerReceiver(new AppEngageBroadcastReceiver(),
new IntentFilter(com.google.android.engage.shopping.service.Intents.ACTION_PUBLISH_SHOPPING_ORDER_TRACKING_CLUSTER));

}
  • Statically declare an implementation with the <receiver> tag in your AndroidManifest.xml file. This allows the application to receive broadcast intents when it is not running, and also allows the application to publish the content.
<application>
   <receiver
      android:name=".AppEngageBroadcastReceiver"
      android:exported="true"
      android:enabled="true">
      <intent-filter>
         <action android:name="com.google.android.engage.action.PUBLISH_RECOMMENDATION" />
      </intent-filter>
      <intent-filter>
         <action android:name="com.google.android.engage.action.PUBLISH_FEATURED" />
      </intent-filter>
      <intent-filter>
         <action android:name="com.google.android.engage.action.shopping.PUBLISH_SHOPPING_CART" />
      </intent-filter>
      <intent-filter>
         <action android:name="com.google.android.engage.action.shopping.PUBLISH_SHOPPING_LIST" />
      </intent-filter>
      <intent-filter>
         <action android:name="com.google.android.engage.action.shopping.PUBLISH_REORDER_CLUSTER" />
      </intent-filter>
      <intent-filter>
         <action android:name="com.google.android.engage.action.shopping.PUBLISH_SHOPPING_ORDER_TRACKING_CLUSTER" />
      </intent-filter>
   </receiver>
</application>

The following intents are sent by the service:

  • com.google.android.engage.action.PUBLISH_RECOMMENDATION It is recommended to start a publishRecommendationClusters call when this intent is received.
  • com.google.android.engage.action.PUBLISH_FEATURED It is recommended to start a publishFeaturedCluster call when this intent is received.
  • com.google.android.engage.action.shopping.PUBLISH_SHOPPING_CART It is recommended to start a publishShoppingCart call when this intent is received.
  • com.google.android.engage.action.shopping.PUBLISH_SHOPPING_LIST It is recommended to start a publishShoppingList call when this intent is received.
  • com.google.android.engage.action.shopping.PUBLISH_REORDER_CLUSTER It is recommended to start a publishReorderCluster call when this intent is received.
  • com.google.android.engage.action.shopping.PUBLISH_SHOPPING_ORDER_TRACKING_CLUSTER It is recommended to start a publishShoppingOrderTrackingCluster call when this intent is received.

Integration workflow

For a step-by-step guide on verifying your integration after it is complete, see Engage developer integration workflow .

سوالات متداول

See Engage SDK Frequently Asked Questions for FAQs.

تماس بگیرید

Contact engage-developers@google.com if there are any questions during the integration process. Our team replies as soon as possible.

مراحل بعدی

After completing this integration, your next steps are as follows:

  • Send an email to engage-developers@google.com and attach your integrated APK that is ready for testing by Google.
  • Google performs a verification and reviews internally to make sure the integration works as expected. If changes are needed, Google contacts you with any necessary details.
  • When testing is complete and no changes are needed, Google contacts you to notify you that you can start publishing the updated and integrated APK to the Play Store.
  • After Google has confirmed that your updated APK has been published to the Play Store, your Recommendation , Featured , Shopping Cart , Shopping List , Reorder Cluster and Shopping Order Tracking Cluster clusters may be published and visible to users.