public void MergeFrom(OfflineUserDataJob other) { if (other == null) { return; } if (other.ResourceName.Length != 0) { ResourceName = other.ResourceName; } if (other.HasId) { Id = other.Id; } if (other.HasExternalId) { ExternalId = other.ExternalId; } if (other.Type != global::Google.Ads.GoogleAds.V10.Enums.OfflineUserDataJobTypeEnum.Types.OfflineUserDataJobType.Unspecified) { Type = other.Type; } if (other.Status != global::Google.Ads.GoogleAds.V10.Enums.OfflineUserDataJobStatusEnum.Types.OfflineUserDataJobStatus.Unspecified) { Status = other.Status; } if (other.FailureReason != global::Google.Ads.GoogleAds.V10.Enums.OfflineUserDataJobFailureReasonEnum.Types.OfflineUserDataJobFailureReason.Unspecified) { FailureReason = other.FailureReason; } if (other.operationMetadata_ != null) { if (operationMetadata_ == null) { OperationMetadata = new global::Google.Ads.GoogleAds.V10.Resources.OfflineUserDataJobMetadata(); } OperationMetadata.MergeFrom(other.OperationMetadata); } switch (other.MetadataCase) { case MetadataOneofCase.CustomerMatchUserListMetadata: if (CustomerMatchUserListMetadata == null) { CustomerMatchUserListMetadata = new global::Google.Ads.GoogleAds.V10.Common.CustomerMatchUserListMetadata(); } CustomerMatchUserListMetadata.MergeFrom(other.CustomerMatchUserListMetadata); break; case MetadataOneofCase.StoreSalesMetadata: if (StoreSalesMetadata == null) { StoreSalesMetadata = new global::Google.Ads.GoogleAds.V10.Common.StoreSalesMetadata(); } StoreSalesMetadata.MergeFrom(other.StoreSalesMetadata); break; } _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); }
public override int GetHashCode() { int hash = 1; if (ResourceName.Length != 0) { hash ^= ResourceName.GetHashCode(); } if (HasId) { hash ^= Id.GetHashCode(); } if (HasExternalId) { hash ^= ExternalId.GetHashCode(); } if (Type != global::Google.Ads.GoogleAds.V10.Enums.OfflineUserDataJobTypeEnum.Types.OfflineUserDataJobType.Unspecified) { hash ^= Type.GetHashCode(); } if (Status != global::Google.Ads.GoogleAds.V10.Enums.OfflineUserDataJobStatusEnum.Types.OfflineUserDataJobStatus.Unspecified) { hash ^= Status.GetHashCode(); } if (FailureReason != global::Google.Ads.GoogleAds.V10.Enums.OfflineUserDataJobFailureReasonEnum.Types.OfflineUserDataJobFailureReason.Unspecified) { hash ^= FailureReason.GetHashCode(); } if (operationMetadata_ != null) { hash ^= OperationMetadata.GetHashCode(); } if (metadataCase_ == MetadataOneofCase.CustomerMatchUserListMetadata) { hash ^= CustomerMatchUserListMetadata.GetHashCode(); } if (metadataCase_ == MetadataOneofCase.StoreSalesMetadata) { hash ^= StoreSalesMetadata.GetHashCode(); } hash ^= (int)metadataCase_; if (_unknownFields != null) { hash ^= _unknownFields.GetHashCode(); } return(hash); }
/// <summary> /// Creates an offline user data job for uploading store sales transactions. /// </summary> /// <param name="offlineUserDataJobServiceClient">The offline user data job service /// client.</param> /// <param name="customerId">The Google Ads customer ID for which the call is made.</param> /// <param name="offlineUserDataJobType">The type of user data in the job (first or third /// party). If you have an official store sales partnership with Google, use /// StoreSalesUploadThirdParty. Otherwise, use StoreSalesUploadFirstParty or /// omit this parameter.</param> /// <param name="externalId">Optional (but recommended) external ID to identify the offline /// user data job.</param> /// <param name="advertiserUploadDateTime">Date and time the advertiser uploaded data to the /// partner. Only required if uploading third party data.</param> /// <param name="bridgeMapVersionId">Version of partner IDs to be used for uploads. Only /// required if uploading third party data.</param> /// <param name="partnerId">ID of the third party partner. Only required if uploading third /// party data.</param> /// <returns>The resource name of the created job.</returns> private string CreateOfflineUserDataJob( OfflineUserDataJobServiceClient offlineUserDataJobServiceClient, long customerId, OfflineUserDataJobType offlineUserDataJobType, long?externalId, string advertiserUploadDateTime, string bridgeMapVersionId, long?partnerId) { // TIP: If you are migrating from the AdWords API, please note that Google Ads API uses // the term "fraction" instead of "rate". For example, loyaltyRate in the AdWords API is // called loyaltyFraction in the Google Ads API. // Please refer to https://support.google.com/google-ads/answer/7506124 for additional // details. StoreSalesMetadata storeSalesMetadata = new StoreSalesMetadata() { // Sets the fraction of your overall sales that you (or the advertiser, in the third // party case) can associate with a customer (email, phone number, address, etc.) in // your database or loyalty program. // For example, set this to 0.7 if you have 100 transactions over 30 days, and out // of those 100 transactions, you can identify 70 by an email address or phone // number. LoyaltyFraction = 0.7, // Sets the fraction of sales you're uploading out of the overall sales that you (or // the advertiser, in the third party case) can associate with a customer. In most // cases, you will set this to 1.0. // Continuing the example above for loyalty fraction, a value of 1.0 here indicates // that you are uploading all 70 of the transactions that can be identified by an // email address or phone number. TransactionUploadFraction = 1.0 }; // Creates additional metadata required for uploading third party data. if (offlineUserDataJobType == OfflineUserDataJobType.StoreSalesUploadThirdParty) { StoreSalesThirdPartyMetadata storeSalesThirdPartyMetadata = new StoreSalesThirdPartyMetadata() { // The date/time must be in the format "yyyy-MM-dd hh:mm:ss". AdvertiserUploadDateTime = advertiserUploadDateTime, // Sets the fraction of transactions you received from the advertiser that // have valid formatting and values. This captures any transactions the // advertiser provided to you but which you are unable to upload to Google // due to formatting errors or missing data. // In most cases, you will set this to 1.0. ValidTransactionFraction = 1.0, // Sets the fraction of valid transactions (as defined above) you received // from the advertiser that you (the third party) have matched to an // external user ID on your side. // In most cases, you will set this to 1.0. PartnerMatchFraction = 1.0, // Sets the fraction of transactions you (the third party) are uploading out // of the transactions you received from the advertiser that meet both of // the following criteria: // 1. Are valid in terms of formatting and values. See valid transaction // fraction above. // 2. You matched to an external user ID on your side. See partner match // fraction above. // In most cases, you will set this to 1.0. PartnerUploadFraction = 1.0, // Sets the version of partner IDs to be used for uploads. // Please speak with your Google representative to get the values to use for // the bridge map version and partner IDs. BridgeMapVersionId = bridgeMapVersionId, // Sets the third party partner ID uploading the transactions. PartnerId = partnerId }; storeSalesMetadata.ThirdPartyMetadata = storeSalesThirdPartyMetadata; } // Creates a new offline user data job. OfflineUserDataJob offlineUserDataJob = new OfflineUserDataJob() { Type = offlineUserDataJobType, StoreSalesMetadata = storeSalesMetadata }; if (externalId.HasValue) { offlineUserDataJob.ExternalId = externalId.Value; } // Issues a request to create the offline user data job. CreateOfflineUserDataJobResponse createOfflineUserDataJobResponse = offlineUserDataJobServiceClient.CreateOfflineUserDataJob( customerId.ToString(), offlineUserDataJob); string offlineUserDataJobResourceName = createOfflineUserDataJobResponse.ResourceName; Console.WriteLine("Created an offline user data job with resource name: " + $"{offlineUserDataJobResourceName}."); return(offlineUserDataJobResourceName); }