/// <summary>
        /// Creates the portfolio bidding strategy.
        /// </summary>
        /// <param name="user">The AdWords user.</param>
        /// <param name="name">The bidding strategy name.</param>
        /// <param name="bidCeiling">The bid ceiling.</param>
        /// <param name="spendTarget">The spend target.</param>
        /// <returns>The bidding strategy object.</returns>
        private SharedBiddingStrategy CreateBiddingStrategy(AdWordsUser user, String name,
                                                            long bidCeiling, long spendTarget)
        {
            using (BiddingStrategyService biddingStrategyService =
                       (BiddingStrategyService)user.GetService(
                           AdWordsService.v201702.BiddingStrategyService)) {
                // Create a portfolio bidding strategy.
                SharedBiddingStrategy portfolioBiddingStrategy = new SharedBiddingStrategy();
                portfolioBiddingStrategy.name = name;

                TargetSpendBiddingScheme biddingScheme = new TargetSpendBiddingScheme();
                // Optionally set additional bidding scheme parameters.
                biddingScheme.bidCeiling             = new Money();
                biddingScheme.bidCeiling.microAmount = bidCeiling;

                biddingScheme.spendTarget             = new Money();
                biddingScheme.spendTarget.microAmount = spendTarget;

                portfolioBiddingStrategy.biddingScheme = biddingScheme;

                // Create operation.
                BiddingStrategyOperation operation = new BiddingStrategyOperation();
                operation.@operator = Operator.ADD;
                operation.operand   = portfolioBiddingStrategy;

                return(biddingStrategyService.mutate(
                           new BiddingStrategyOperation[] { operation }).value[0]);
            }
        }
Beispiel #2
0
        /// <summary>
        /// Creates the shared bidding strategy.
        /// </summary>
        /// <param name="biddingStrategyService">The bidding strategy service.</param>
        /// <param name="name">The bidding strategy name.</param>
        /// <param name="bidCeiling">The bid ceiling.</param>
        /// <param name="spendTarget">The spend target.</param>
        /// <returns>The bidding strategy object.</returns>
        private SharedBiddingStrategy CreateBiddingStrategy(
            BiddingStrategyService biddingStrategyService, String name, long bidCeiling,
            long spendTarget)
        {
            // Create a shared bidding strategy.
            SharedBiddingStrategy sharedBiddingStrategy = new SharedBiddingStrategy();

            sharedBiddingStrategy.name = name;

            TargetSpendBiddingScheme biddingScheme = new TargetSpendBiddingScheme();

            // Optionally set additional bidding scheme parameters.
            biddingScheme.bidCeiling             = new Money();
            biddingScheme.bidCeiling.microAmount = bidCeiling;

            biddingScheme.spendTarget             = new Money();
            biddingScheme.spendTarget.microAmount = spendTarget;

            sharedBiddingStrategy.biddingScheme = biddingScheme;

            // Create operation.
            BiddingStrategyOperation operation = new BiddingStrategyOperation();

            operation.@operator = Operator.ADD;
            operation.operand   = sharedBiddingStrategy;

            return(biddingStrategyService.mutate(new BiddingStrategyOperation[] { operation }).value[0]);
        }
Beispiel #3
0
        /// <summary>
        /// Creates the portfolio bidding strategy.
        /// </summary>
        /// <param name="user">The AdWords user.</param>
        /// <param name="name">The bidding strategy name.</param>
        /// <param name="bidCeiling">The bid ceiling.</param>
        /// <param name="spendTarget">The spend target.</param>
        /// <returns>The bidding strategy object.</returns>
        private SharedBiddingStrategy CreateBiddingStrategy(AdWordsUser user, string name,
                                                            long bidCeiling, long spendTarget)
        {
            using (BiddingStrategyService biddingStrategyService =
                       (BiddingStrategyService)user.GetService(
                           AdWordsService.v201806.BiddingStrategyService)) {
                // Create a portfolio bidding strategy.
                SharedBiddingStrategy portfolioBiddingStrategy = new SharedBiddingStrategy {
                    name = name
                };

                TargetSpendBiddingScheme biddingScheme = new TargetSpendBiddingScheme {
                    // Optionally set additional bidding scheme parameters.
                    bidCeiling = new Money {
                        microAmount = bidCeiling
                    },

                    spendTarget = new Money {
                        microAmount = spendTarget
                    }
                };

                portfolioBiddingStrategy.biddingScheme = biddingScheme;

                // Create operation.
                BiddingStrategyOperation operation = new BiddingStrategyOperation {
                    @operator = Operator.ADD,
                    operand   = portfolioBiddingStrategy
                };

                return(biddingStrategyService.mutate(
                           new BiddingStrategyOperation[] { operation }).value[0]);
            }
        }
    /// <summary>
    /// Creates the shared bidding strategy.
    /// </summary>
    /// <param name="biddingStrategyService">The bidding strategy service.</param>
    /// <param name="name">The bidding strategy name.</param>
    /// <param name="bidCeiling">The bid ceiling.</param>
    /// <param name="spendTarget">The spend target.</param>
    /// <returns>The bidding strategy object.</returns>
    private SharedBiddingStrategy CreateBiddingStrategy(
        BiddingStrategyService biddingStrategyService, String name, long bidCeiling,
        long spendTarget) {
      // Create a shared bidding strategy.
      SharedBiddingStrategy sharedBiddingStrategy = new SharedBiddingStrategy();
      sharedBiddingStrategy.name = name;

      TargetSpendBiddingScheme biddingScheme = new TargetSpendBiddingScheme();
      // Optionally set additional bidding scheme parameters.
      biddingScheme.bidCeiling = new Money();
      biddingScheme.bidCeiling.microAmount = bidCeiling;

      biddingScheme.spendTarget = new Money();
      biddingScheme.spendTarget.microAmount = spendTarget;

      sharedBiddingStrategy.biddingScheme = biddingScheme;

      // Create operation.
      BiddingStrategyOperation operation = new BiddingStrategyOperation();
      operation.@operator = Operator.ADD;
      operation.operand = sharedBiddingStrategy;

      return biddingStrategyService.mutate(new BiddingStrategyOperation[] {operation}).value[0];
    }