How to get the AW-CONVERSION_LABEL?

1,308 views
Skip to first unread message

Nguyen Mark

unread,
Oct 26, 2020, 1:03:50 AM10/26/20
to AdWords API and Google Ads API Forum
Hi there,
Is there a way to get/ generate AW-CONVERSION_LABEL after created a conversion tracking?
4.PNG

 

Google Ads API Forum Advisor Prod

unread,
Oct 26, 2020, 2:39:16 PM10/26/20
to maker...@gmail.com, adwor...@googlegroups.com

Hi Nguyen,

Thank you for reaching out. There isn’t any service available to fetch the Conversion Id and Label in the existing conversion set up in the Adwords/Google Ads API. The workaround is to delete the old one that wasn’t properly set up and create new conversions to get a new set of Conversion Id and Label. 

Thanks and regards,
Xiaoming, Google Ads API Team


Google Logo
Xiaoming
Google Ads API Team
 


ref:_00D1U1174p._5004Q274axa:ref

Nguyen Mark

unread,
Oct 27, 2020, 12:05:13 AM10/27/20
to AdWords API and Google Ads API Forum
Thanks for your supported

Vào lúc 01:39:16 UTC+7 ngày Thứ Ba, 27 tháng 10, 2020, adsapiforumadvisor đã viết:

Nguyen Mark

unread,
Oct 27, 2020, 3:42:53 AM10/27/20
to AdWords API and Google Ads API Forum
Hi
From the example AddConversionAction i'm trying to get the tagSnipped via the method getTagSnippeds() but i've got error:

Uncaught Error: Call to undefined method Google\Ads\GoogleAds\V5\Services\MutateConversionActionResult::getTagSnippets()

Here is my code logic

        // Creates a conversion action.
        $conversionAction = new ConversionAction([
            'name' => $data->conv_name . uniqid(),
            'category' => $data->conv_category,
            'type' => ConversionActionType::WEBPAGE,
            'status' => ConversionActionStatus::ENABLED,
            'value_settings' => new ValueSettings([
                'default_value' => $data->conv_value,
                'always_use_default_value' => true
            ])
        ]);

        if ($data->conv_counting_type != null && $data->conv_counting_type > 0) {
            $conversionAction->setCountingType($data->conv_counting_type);
        }
        if ($data->conv_click_window_days != null && $data->conv_click_window_days > 0) {
            $conversionAction->setClickThroughLookbackWindowDays($data->conv_click_window_days);
        }
        if ($data->conv_view_window_days != null && $data->conv_view_window_days > 0) {
            $conversionAction->setViewThroughLookbackWindowDays($data->conv_view_window_days);
        }
        // Creates a conversion action operation.
        $conversionActionOperation = new ConversionActionOperation();
        $conversionActionOperation->setCreate($conversionAction);

        // Issues a mutate request to add the conversion action.
        $serviceClient = $gaClient->getConversionActionServiceClient();
        $response = $serviceClient->mutateConversionActions(
            $clientInfo->customer_id,
            [$conversionActionOperation]
        );
        if ($response->getResults()->count() == 0) {
            return null;
        }

        /** @var ConversionAction $addedConversionAction */
        $addedConversionAction = $response->getResults()[0];

        $globalSiteTag = '';
        $eventSnippet = '';
        foreach ($addedConversionAction->getTagSnippets() as $tagSnippet) {
            /** @var TagSnippet $tagSnippet */
            $globalSiteTag = $tagSnippet->getGlobalSiteTag();
            $eventSnippet = $tagSnippet->getEventSnippet();
            break;
        }

plz help me check it.

Vào lúc 11:05:13 UTC+7 ngày Thứ Ba, 27 tháng 10, 2020, Nguyen Mark đã viết:

Google Ads API Forum Advisor Prod

unread,
Oct 27, 2020, 2:28:30 PM10/27/20
to maker...@gmail.com, adwor...@googlegroups.com

Hi Nguyen,

Thank you for reaching out. Please give it a try to loop through all the results in the response and for each result you could call the getTagSnippets() method. I’m assuming something went wrong when you loop through $addedConversionAction->getTagSnippets() as this might be not iterable.



Thanks and regards,
Xiaoming, Google Ads API Team


SJ Sagar

unread,
Sep 4, 2022, 8:02:41 AM9/4/22
to Google Ads API and AdWords API Forum
Hii 

Can you get successfully snippets code ??? 

if you get please guide me , what we do after response


Regards 
S.J

Google Ads API Forum Advisor

unread,
Sep 5, 2022, 1:56:24 AM9/5/22
to sagarji...@gmail.com, adwor...@googlegroups.com

Hi SJ,
 

Thanks for reaching out to the Google Ads API team. I hope you are doing well today.
 

Moving forward, regarding this, "Can you get successfully snippets code ??? " can I ask you to raise this issue with us so that you can get an answer to this forum case? If yes, one of my colleagues responded to that forum case and allowed me to reiterate his response. "Please note that the only field that can be used to extract tag snippets of the conversion action is the conversion_action.tag_snippets field. With this, I am afraid that there is no way to extract the value from the 'send_to' field alone. You will need to create a process on your end where you will separate the said value from the returned response of the API."
 

Let us know if you have further questions.


Regards,

Google Logo
Darwin
Google Ads API Team
 


ref:_00D1U1174p._5004Q274axa:ref
Reply all
Reply to author
Forward
0 new messages