این راهنما دستورالعملهای دقیقی برای بارگذاری تبدیلهای آفلاین
بااستفاده از سرویس میانای برنامهسازی کاربردی Campaign Manager 360 Conversions ارائه میدهد. قبلاز
ادامه دادن، توصیه میشود که
نمای کلی را برای آشنایی با تبدیلهای آفلاین
و مفاهیم موردبحث در این راهنما مرور کنید.
پیکربندی منابع تبدیل
اولین مرحله در فرایند بارگذاری تبدیل، ایجاد یک یا چند
شیء منبع Conversion است. هرکدام از این اشیاء
نشاندهنده یک رویداد تبدیل است و چند فیلد الزامی دارد:
| فیلد | شرح |
|---|---|
floodlightActivityId |
فعالیت Floodlight که این تبدیل با آن مرتبط خواهد شد. |
floodlightConfigurationId |
پیکربندی Floodlight که توسط فعالیت مشخصشده استفاده میشود. |
ordinal |
مقداری که برای کنترل نحوه حذف تبدیلهای تکراری از یک دستگاه یا کاربر در یک روز استفاده میشود. برای اطلاعات بیشتر، پرسشگان را ببینید. |
timestampMicros |
مُهر زمان تبدیل، برحسب میکروثانیه از تاریخ یونیکس. |
علاوهبراین، هر شیء باید حاوی یکی از فیلدهای زیر باشد:
| فیلد | شرح |
|---|---|
encryptedUserId |
یک شناسه کاربر رمزگذاریشده که از ماکرو مطابقت%m یا انتقال داده بهدست آمده است. |
encryptedUserIdCandidates[] |
فهرستی از شناسههای کاربر رمزگذاریشده که از ماکرو مطابقت%m یا انتقال داده بهدست آمده است. اولین شناسه از این شناسهها با نورافکن ثبتشده قبلاز timestampMicros مشخصشده استفاده خواهد شد. اگر هیچکدام از شناسهها با مواجهه موجود مطابقت نداشته باشد، خطایی نشان داده میشود. |
dclid |
شناسه کلیک نمایش که توسط Campaign Manager 360 یا Display & Video 360 تولید شده است. |
gclid |
شناسه کلیک Google که توسط Google Ads یا Search Ads 360 تولید شده است. |
matchId |
شناسه یکتای ایجادشده توسط آگهیدهنده که ازطریق برچسب Floodlight به Campaign Manager 360 ارسال میشود. |
mobileDeviceId |
شناسه تلفن همراه رمزگذارینشده در قالب IDFA یا AdID یا «شناسه تبلیغاتی تلویزیون متصل» (IFA) از پلاتفرم دستگاه تلویزیون متصل پشتیبانیشده (Roku، Fire TV، Android TV، Apple TV، Xbox، Samsung، Vizio). |
درنهایت، هر تبدیل دو سنجه دارد:
| فیلد | شرح |
|---|---|
quantity |
الزامی. تعداد موارد مرتبط با تبدیل. برای اینکه تبدیل در سنجههای خاصی (مانند کل تبدیلها) محاسبه شود، باید حداقل ۱ باشد. |
value |
مبلغ دلاری مرتبط با تبدیل. به واحد پول تبلیغکننده مالک پیکربندی Floodlight تفسیر میشود. |
فیلدهای اختیاری در اسناد مرجع مستند شدهاند.
مثال زیر ایجاد یک شیء منبع تبدیل ساده را نشان میدهد:
C#
// Generate a timestamp in milliseconds since Unix epoch. TimeSpan timeSpan = DateTime.UtcNow - new DateTime(1970, 1, 1); long currentTimeInMilliseconds = (long) timeSpan.TotalMilliseconds; // Find the Floodlight configuration ID based on the provided activity ID. FloodlightActivity floodlightActivity = service.FloodlightActivities.Get(profileId, floodlightActivityId).Execute(); long floodlightConfigurationId = (long) floodlightActivity.FloodlightConfigurationId; // Create the conversion. Conversion conversion = new Conversion(); conversion.EncryptedUserId = conversionUserId; conversion.FloodlightActivityId = floodlightActivityId; conversion.FloodlightConfigurationId = floodlightConfigurationId; conversion.Ordinal = currentTimeInMilliseconds.ToString(); conversion.TimestampMicros = currentTimeInMilliseconds * 1000;
جاوا
long currentTimeInMilliseconds = System.currentTimeMillis(); // Find Floodlight configuration ID based on the provided activity ID. FloodlightActivity floodlightActivity = reporting.floodlightActivities() .get(profileId, floodlightActivityId).execute(); long floodlightConfigurationId = floodlightActivity.getFloodlightConfigurationId(); Conversion conversion = new Conversion(); conversion.setEncryptedUserId(encryptedUserId); conversion.setFloodlightActivityId(floodlightActivityId); conversion.setFloodlightConfigurationId(floodlightConfigurationId); conversion.setOrdinal(String.valueOf(currentTimeInMilliseconds)); conversion.setTimestampMicros(currentTimeInMilliseconds * 1000);
PHP
$currentTimeInMicros = time() * 1000 * 1000; // Find Floodlight configuration ID based on provided activity ID. $activity = $this->service->floodlightActivities->get( $values['user_profile_id'], $values['floodlight_activity_id'] ); $floodlightConfigId = $activity->getFloodlightConfigurationId(); $conversion = new Google_Service_Dfareporting_Conversion(); $conversion->setEncryptedUserId($values['encrypted_user_id']); $conversion->setFloodlightActivityId($values['floodlight_activity_id']); $conversion->setFloodlightConfigurationId($floodlightConfigId); $conversion->setOrdinal($currentTimeInMicros); $conversion->setTimestampMicros($currentTimeInMicros);
Python
# Look up the Floodlight configuration ID based on activity ID. floodlight_activity = ( service.floodlightActivities() .get(profileId=str(profile_id), id=str(floodlight_activity_id)) .execute() ) floodlight_config_id = floodlight_activity['floodlightConfigurationId'] current_time_in_micros = int(time.time() * 1000000) # Construct the conversion. conversion = { 'encryptedUserId': encrypted_user_id, 'floodlightActivityId': floodlight_activity_id, 'floodlightConfigurationId': floodlight_config_id, 'ordinal': current_time_in_micros, 'timestampMicros': current_time_in_micros }
Ruby
# Look up the Floodlight configuration ID based on activity ID. floodlight_activity = service.get_floodlight_activity(profile_id, floodlight_activity_id) floodlight_config_id = floodlight_activity.floodlight_configuration_id current_time_in_micros = DateTime.now.strftime('%Q').to_i * 1000 # Construct the conversion. conversion = DfareportingUtils::API_NAMESPACE::Conversion.new( encrypted_user_id: encrypted_user_id, floodlight_activity_id: floodlight_activity_id, floodlight_configuration_id: floodlight_config_id, ordinal: current_time_in_micros, timestamp_micros: current_time_in_micros )
مشخص کردن اطلاعات رمزگذاری
اگر قصد دارید تبدیلهای آفلاین را به شناسههای کاربر رمزگذاریشده نسبت دهید، مانند مثال قبلی، باید جزئیاتی درباره نحوه رمزگذاری آنها بهعنوان بخشی از درخواست درج خود ارائه دهید. بهطور خاص، باید بدانید:
منبع رمزگذاری که توضیح میدهد دسته شناسههای رمزگذاریشده از کجا آمده است. مقادیر قابلقبول عبارتند از
AD_SERVINGبرای شناسههایی که از ماکرو مطابقت %m منبعیابی شدهاند، یاDATA_TRANSFERبرای شناسههایی که از فایلهای «انتقال داده» منبعیابی شدهاند.نهاد رمزگذاری که مجموعهای منحصربهفرد از مقادیر است که برای رمزگذاری شناسههای کاربر استفاده میشود. این مقادیر معمولاً به حساب Campaign Manager 360 مربوط میشوند وقتیکه منبع «انتقال داده» باشد، یا به تبلیغکننده Campaign Manager 360 مربوط میشوند وقتیکه منبع ماکرو %m باشد، اما همیشه اینطور نیست. اگر مطمئن نیستید، برای اطلاعات بیشتر با نماینده حساب Campaign Manager 360 یا پشتیبانی Campaign Manager 360 تماس بگیرید.
درصورت لزوم، ایجاد یک
شیء EncryptionInfo که این مقادیر را مشخص میکند،
مرحله دوم در فرایند بارگذاری تبدیل است:
C#
// Create the encryption info. EncryptionInfo encryptionInfo = new EncryptionInfo(); encryptionInfo.EncryptionEntityId = encryptionEntityId; encryptionInfo.EncryptionEntityType = encryptionEntityType; encryptionInfo.EncryptionSource = encryptionSource;
جاوا
// Create the encryption info. EncryptionInfo encryptionInfo = new EncryptionInfo(); encryptionInfo.setEncryptionEntityId(encryptionEntityId); encryptionInfo.setEncryptionEntityType(encryptionEntityType); encryptionInfo.setEncryptionSource(encryptionSource);
PHP
$encryptionInfo = new Google_Service_Dfareporting_EncryptionInfo(); $encryptionInfo->setEncryptionEntityId($values['encryption_entity_id']); $encryptionInfo->setEncryptionEntityType($values['encryption_entity_type']); $encryptionInfo->setEncryptionSource($values['encryption_source']);
Python
# Construct the encryption info. encryption_info = { 'encryptionEntityId': encryption_entity_id, 'encryptionEntityType': encryption_entity_type, 'encryptionSource': encryption_source }
Ruby
# Construct the encryption info. encryption_info = DfareportingUtils::API_NAMESPACE::EncryptionInfo.new( encryption_entity_id: encryption[:entity_id], encryption_entity_type: encryption[:entity_type], encryption_source: encryption[:source] )
توجه داشته باشید که هر درخواست درج فقط میتواند حاوی یک شیء EncryptionInfo باشد. این یعنی همه تبدیلهای موجود در یک درخواست معین باید
از یک منبع باشند و از یک نهاد رمزگذاری استفاده کنند.
تولید درخواست درج
مرحله نهایی در این فرایند، بارگذاری تبدیلهایتان با فراخوانی
batchinsert است. این روش یک شیء ConversionsBatchInsertRequest را میپذیرد که مجموعه تبدیلهای قابل بارگذاری را با اطلاعات رمزگذاری مرتبط (درصورت لزوم) ترکیب میکند:
C#
// Insert the conversion. ConversionsBatchInsertRequest request = new ConversionsBatchInsertRequest(); request.Conversions = new List<Conversion>() { conversion }; request.EncryptionInfo = encryptionInfo; ConversionsBatchInsertResponse response = service.Conversions.Batchinsert(request, profileId).Execute();
جاوا
ConversionsBatchInsertRequest request = new ConversionsBatchInsertRequest(); request.setConversions(ImmutableList.of(conversion)); request.setEncryptionInfo(encryptionInfo); ConversionsBatchInsertResponse response = reporting.conversions() .batchinsert(profileId, request).execute();
PHP
$batch = new Google_Service_Dfareporting_ConversionsBatchInsertRequest(); $batch->setConversions([$conversion]); $batch->setEncryptionInfo($encryptionInfo); $result = $this->service->conversions->batchinsert( $values['user_profile_id'], $batch );
Python
# Insert the conversion. request_body = { 'conversions': [conversion], 'encryptionInfo': encryption_info } request = service.conversions().batchinsert( profileId=str(profile_id), body=request_body ) response = request.execute()
Ruby
# Construct the batch insert request. batch_insert_request = DfareportingUtils::API_NAMESPACE::ConversionsBatchInsertRequest.new( conversions: [conversion], encryption_info: encryption_info ) # Insert the conversion. result = service.batchinsert_conversion(profile_id, batch_insert_request)
توجه داشته باشید که Campaign Manager 360 تلاش میکند هر تبدیل را در درخواست شما بهصورت بهترین تلاش درج کند، نه اینکه کل دسته را بهعنوان یک تراکنش همهیاهیچ درج کند. اگر برخیاز تبدیلها در یک دسته درج نشوند،
ممکن است بقیه همچنان باموفقیت درج شوند. بنابراین، توصیه میشود
ConversionsBatchInsertResponse برگرداندهشده را بررسی کنید تا
وضعیت هر تبدیل را تعیین کنید:
C#
// Handle the batchinsert response. if (!response.HasFailures.Value) { Console.WriteLine("Successfully inserted conversion for encrypted user ID {0}.", conversionUserId); } else { Console.WriteLine("Error(s) inserting conversion for encrypted user ID {0}:", conversionUserId); ConversionStatus status = response.Status[0]; foreach(ConversionError error in status.Errors) { Console.WriteLine("\t[{0}]: {1}", error.Code, error.Message); } }
جاوا
if (!response.getHasFailures()) { System.out.printf("Successfully inserted conversion for encrypted user ID %s.%n", encryptedUserId); } else { System.out.printf("Error(s) inserting conversion for encrypted user ID %s:%n", encryptedUserId); // Retrieve the conversion status and report any errors found. If multiple conversions // were included in the original request, the response would contain a status for each. ConversionStatus status = response.getStatus().get(0); for (ConversionError error : status.getErrors()) { System.out.printf("\t[%s]: %s.%n", error.getCode(), error.getMessage()); } }
PHP
if (!$result->getHasFailures()) { printf( 'Successfully inserted conversion for encrypted user ID %s.', $values['encrypted_user_id'] ); } else { printf( 'Error(s) inserting conversion for encrypted user ID %s:<br><br>', $values['encrypted_user_id'] ); $status = $result->getStatus()[0]; foreach ($status->getErrors() as $error) { printf('[%s] %s<br>', $error->getCode(), $error->getMessage()); } }
Python
if not response['hasFailures']: print( 'Successfully inserted conversion for encrypted user ID %s.' % encrypted_user_id ) else: print( 'Error(s) inserting conversion for encrypted user ID %s.' % encrypted_user_id ) status = response['status'][0] for error in status['errors']: print('\t[%s]: %s' % (error['code'], error['message']))
Ruby
if result.has_failures puts format('Error(s) inserting conversion for encrypted user ID %s.', encrypted_user_id) status = result.status[0] status.errors.each do |error| puts format("\t[%s]: %s", error.code, error.message) end else puts format('Successfully inserted conversion for encrypted user ID %s.', encrypted_user_id) end
فیلد status پاسخ حاوی یک شیء ConversionStatus برای هر تبدیل موجود در درخواست اصلی خواهد بود. اگر فقط به تبدیلهایی که درج نشدهاند علاقه دارید، میتوانید از فیلد hasFailures استفاده کنید تا بهسرعت تعیین کنید که آیا هیچ تبدیلی در دسته ارائهشده ناموفق بوده است یا نه. برای
راهنمایی درباره نحوه رسیدگی به هر کد خطا و اینکه کدام تبدیلهای ناموفق را
دوباره امتحان کنید (INTERNAL و NOT_FOUND)، به
پرسشگان مراجعه کنید.
درستیسنجی پردازش شدن تبدیلها
تبدیلهای بارگذاریشده معمولاً ظرف ۲۴ ساعت پردازش میشوند و برای گزارشدهی دردسترس قرار میگیرند. برای درستیسنجی اینکه تبدیلهایی که بارگذاری کردهاید پردازش شدهاند یا نه، توصیه میشود گزارش ظهورهای Floodlight را اجرا کنید. برخلاف سایر گزارشهای اسنادی، این گزارشها بهطور پیشفرض هم تبدیلهای اسنادی (مرتبط با آگهی) و هم تبدیلهای غیر اسنادی را برمیگردانند. این امر آن را برای بررسی سریع اینکه آیا تبدیلهایی که ارسال کردهاید به Campaign Manager 360 رسیدهاند یا نه، ایدهآل میکند.