/// <summary>Snippet for GetRemarketingAction</summary>
 /// <remarks>
 /// This snippet has been automatically generated for illustrative purposes only.
 /// It may require modifications to work in your environment.
 /// </remarks>
 public void GetRemarketingAction()
 {
     // Create client
     RemarketingActionServiceClient remarketingActionServiceClient = RemarketingActionServiceClient.Create();
     // Initialize request argument(s)
     string resourceName = "customers/[CUSTOMER_ID]/remarketingActions/[REMARKETING_ACTION_ID]";
     // Make the request
     RemarketingAction response = remarketingActionServiceClient.GetRemarketingAction(resourceName);
 }
Example #2
0
 /// <summary>Snippet for GetRemarketingAction</summary>
 /// <remarks>
 /// This snippet has been automatically generated for illustrative purposes only.
 /// It may require modifications to work in your environment.
 /// </remarks>
 public void GetRemarketingActionResourceNames()
 {
     // Create client
     RemarketingActionServiceClient remarketingActionServiceClient = RemarketingActionServiceClient.Create();
     // Initialize request argument(s)
     RemarketingActionName resourceName = RemarketingActionName.FromCustomerRemarketingAction("[CUSTOMER_ID]", "[REMARKETING_ACTION_ID]");
     // Make the request
     RemarketingAction response = remarketingActionServiceClient.GetRemarketingAction(resourceName);
 }
        /// <summary>Snippet for GetRemarketingActionAsync</summary>
        /// <remarks>
        /// This snippet has been automatically generated for illustrative purposes only.
        /// It may require modifications to work in your environment.
        /// </remarks>
        public async Task GetRemarketingActionAsync()
        {
            // Create client
            RemarketingActionServiceClient remarketingActionServiceClient = await RemarketingActionServiceClient.CreateAsync();

            // Initialize request argument(s)
            string resourceName = "customers/[CUSTOMER]/remarketingActions/[REMARKETING_ACTION]";
            // Make the request
            RemarketingAction response = await remarketingActionServiceClient.GetRemarketingActionAsync(resourceName);
        }
        /// <summary>Snippet for GetRemarketingActionAsync</summary>
        /// <remarks>
        /// This snippet has been automatically generated for illustrative purposes only.
        /// It may require modifications to work in your environment.
        /// </remarks>
        public async Task GetRemarketingActionResourceNamesAsync()
        {
            // Create client
            RemarketingActionServiceClient remarketingActionServiceClient = await RemarketingActionServiceClient.CreateAsync();

            // Initialize request argument(s)
            RemarketingActionName resourceName = RemarketingActionName.FromCustomerRemarketingAction("[CUSTOMER]", "[REMARKETING_ACTION]");
            // Make the request
            RemarketingAction response = await remarketingActionServiceClient.GetRemarketingActionAsync(resourceName);
        }
Example #5
0
 /// <summary>Snippet for GetRemarketingAction</summary>
 public void GetRemarketingAction()
 {
     // Snippet: GetRemarketingAction(string, CallSettings)
     // Create client
     RemarketingActionServiceClient remarketingActionServiceClient = RemarketingActionServiceClient.Create();
     // Initialize request argument(s)
     string resourceName = "customers/[CUSTOMER]/remarketingActions/[REMARKETING_ACTION]";
     // Make the request
     RemarketingAction response = remarketingActionServiceClient.GetRemarketingAction(resourceName);
     // End snippet
 }
Example #6
0
 /// <summary>Snippet for GetRemarketingAction</summary>
 /// <remarks>
 /// This snippet has been automatically generated for illustrative purposes only.
 /// It may require modifications to work in your environment.
 /// </remarks>
 public void GetRemarketingActionRequestObject()
 {
     // Create client
     RemarketingActionServiceClient remarketingActionServiceClient = RemarketingActionServiceClient.Create();
     // Initialize request argument(s)
     GetRemarketingActionRequest request = new GetRemarketingActionRequest
     {
         ResourceNameAsRemarketingActionName = RemarketingActionName.FromCustomerRemarketingAction("[CUSTOMER]", "[REMARKETING_ACTION]"),
     };
     // Make the request
     RemarketingAction response = remarketingActionServiceClient.GetRemarketingAction(request);
 }
Example #7
0
        /// <summary>Snippet for GetRemarketingActionAsync</summary>
        public async Task GetRemarketingActionAsync()
        {
            // Snippet: GetRemarketingActionAsync(string, CallSettings)
            // Additional: GetRemarketingActionAsync(string, CancellationToken)
            // Create client
            RemarketingActionServiceClient remarketingActionServiceClient = await RemarketingActionServiceClient.CreateAsync();

            // Initialize request argument(s)
            string resourceName = "customers/[CUSTOMER_ID]/remarketingActions/[REMARKETING_ACTION_ID]";
            // Make the request
            RemarketingAction response = await remarketingActionServiceClient.GetRemarketingActionAsync(resourceName);

            // End snippet
        }
Example #8
0
        /// <summary>Snippet for GetRemarketingActionAsync</summary>
        public async Task GetRemarketingActionResourceNamesAsync()
        {
            // Snippet: GetRemarketingActionAsync(RemarketingActionName, CallSettings)
            // Additional: GetRemarketingActionAsync(RemarketingActionName, CancellationToken)
            // Create client
            RemarketingActionServiceClient remarketingActionServiceClient = await RemarketingActionServiceClient.CreateAsync();

            // Initialize request argument(s)
            RemarketingActionName resourceName = RemarketingActionName.FromCustomerRemarketingAction("[CUSTOMER_ID]", "[REMARKETING_ACTION_ID]");
            // Make the request
            RemarketingAction response = await remarketingActionServiceClient.GetRemarketingActionAsync(resourceName);

            // End snippet
        }
Example #9
0
        public void GetRemarketingAction2()
        {
            Mock <RemarketingActionService.RemarketingActionServiceClient> mockGrpcClient = new Mock <RemarketingActionService.RemarketingActionServiceClient>(MockBehavior.Strict);
            GetRemarketingActionRequest request = new GetRemarketingActionRequest
            {
                ResourceName = new RemarketingActionName("[CUSTOMER]", "[REMARKETING_ACTION]").ToString(),
            };
            RemarketingAction expectedResponse = new RemarketingAction
            {
                ResourceName = "resourceName2625949903",
            };

            mockGrpcClient.Setup(x => x.GetRemarketingAction(request, It.IsAny <CallOptions>()))
            .Returns(expectedResponse);
            RemarketingActionServiceClient client = new RemarketingActionServiceClientImpl(mockGrpcClient.Object, null);
            RemarketingAction response            = client.GetRemarketingAction(request);

            Assert.AreEqual(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }
Example #10
0
        public async Task GetRemarketingActionAsync2()
        {
            Mock <RemarketingActionService.RemarketingActionServiceClient> mockGrpcClient = new Mock <RemarketingActionService.RemarketingActionServiceClient>(MockBehavior.Strict);
            GetRemarketingActionRequest request = new GetRemarketingActionRequest
            {
                ResourceName = new RemarketingActionName("[CUSTOMER]", "[REMARKETING_ACTION]").ToString(),
            };
            RemarketingAction expectedResponse = new RemarketingAction
            {
                ResourceName = "resourceName2625949903",
            };

            mockGrpcClient.Setup(x => x.GetRemarketingActionAsync(request, It.IsAny <CallOptions>()))
            .Returns(new Grpc.Core.AsyncUnaryCall <RemarketingAction>(Task.FromResult(expectedResponse), null, null, null, null));
            RemarketingActionServiceClient client = new RemarketingActionServiceClientImpl(mockGrpcClient.Object, null);
            RemarketingAction response            = await client.GetRemarketingActionAsync(request);

            Assert.AreEqual(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }
Example #11
0
        /// <summary>
        /// Runs the code example.
        /// </summary>
        /// <param name="client">The Google Ads client.</param>
        /// <param name="customerId">The Google Ads customer ID for the conversion action is
        /// added.</param>
        public void Run(GoogleAdsClient client, long customerId)
        {
            // Get the RemarketingActionService.
            RemarketingActionServiceClient remarketingActionService =
                client.GetService(Services.V2.RemarketingActionService);

            // Get the GoogleAdsService.
            GoogleAdsServiceClient googleAdsService =
                client.GetService(Services.V2.GoogleAdsService);

            try
            {
                // Creates a remarketing action with the specified name.
                RemarketingAction remarketingAction = new RemarketingAction()
                {
                    Name = $"Remarketing action # {ExampleUtilities.GetRandomString()}"
                };
                // Creates a remarketing action operation.
                RemarketingActionOperation remarketingActionOperation =
                    new RemarketingActionOperation()
                {
                    Create = remarketingAction
                };

                // Issues a mutate request to add the remarketing action and prints out
                // some information.
                MutateRemarketingActionsResponse response =
                    remarketingActionService.MutateRemarketingActions(
                        customerId.ToString(), new[] { remarketingActionOperation });

                string remarketingActionResourceName = response.Results[0].ResourceName;

                Console.WriteLine($"Added remarketing action with resource name " +
                                  $"'{remarketingActionResourceName}'.");

                // Creates a query that retrieves the previously created remarketing action
                // with its generated tag snippets.
                var query = $"SELECT remarketing_action.id, remarketing_action.name, " +
                            $"remarketing_action.tag_snippets FROM remarketing_action " +
                            $"WHERE remarketing_action.resource_name = '{remarketingActionResourceName}'";

                // Issues a search request and retrieve the results. There is only one row
                // because we limited the search using the resource name, which is unique.
                RemarketingAction result = googleAdsService.Search(customerId.ToString(), query)
                                           .First()
                                           .RemarketingAction;

                // Display the result.
                Console.WriteLine($"Remarketing action has ID {result.Id} and name" +
                                  $" '{result.Id}'.");

                Console.WriteLine("It has the following generated tag snippets:");
                foreach (TagSnippet tagSnippet in result.TagSnippets)
                {
                    Console.WriteLine($"Tag snippet with code type '{tagSnippet.Type}' and code " +
                                      $"page format '{tagSnippet.PageFormat}' has the following global site " +
                                      $"tag:{tagSnippet.GlobalSiteTag} \n\nand the following event snippet:" +
                                      $"{tagSnippet.EventSnippet}.");
                }
            }
            catch (GoogleAdsException e)
            {
                Console.WriteLine("Failure:");
                Console.WriteLine($"Message: {e.Message}");
                Console.WriteLine($"Failure: {e.Failure}");
                Console.WriteLine($"Request ID: {e.RequestId}");
            }
        }