/webdesigner/community?hl=en
This content is likely not relevant anymore. Try searching or browse recent questions.
-
11/17/19
Want to use SubString method in dynamic ads 0 Recommended Answers 3 Replies 0 Upvotes
1 Recommended Answer
$0 Recommended Answers
Last edited 11/27/19
Hi,

Please respond to my message, I will really appreciate.

I need to show some part of the product name from the feed, which means i have to ignore first 3-4 characters of the string and show the rest of it. Somewhat like this var res = str.substring(3);

Let me know how can i do that, kets say if the product name is 'Abcxyz' then i only want to show XYZ and not ABC from the feed column. Is this possible? Even if it doesn't get accepted by google ads, can you share the code with me?

Thanks
Nitesh
Details
All Replies (3)
You can do this with custom JavaScript and the transformDynamicData() function described in this forum thread: https://support.google.com/webdesigner/thread/740534?hl=en
This assumes you are using the Google Ads environment and you can see an example in the Google Web Designer Template > Dynamic Remarketing For Google Ads > #2 Single Page with Minimal Details where that function is used to format the discount price string--you would edit to update your product name.

Hope that helps,

Kent
Google Web Designer team
marked this as an answer
Helpful?
-
11/26/19
Thanks for responding Kent, I couldn't find Product name related variable in the code in a template with product name. I found Discount code in the template you mentioned but I don't know how I can use it in another template with product name.

Can you help me with this? 

Can you share some pointers or code, whatever you are comfortable with

I will really appreciate if you can help me
marked this as an answer
Helpful?
Refer to the product name like this: dynamicData.Product[i].name

To get a quick working example, use that  template I mentioned but add dynamic names to it (bind text-content to Product Summary), and then replace the entire transformDynamicData function with the code below:

function transformDynamicData () {
    var dataProvider = document.querySelector('#' + elementId_.gpaDataProvider);
    dataProvider.addDataTransformer(function(dynamicData) {
        dynamicData.Product[0].name += 'new text added';
    });
}

This function simply appends "new text added" to the first product name. I understand you need a different manipulation but this gives you an example of working with dynamic name text from which you should be able to revise for your case. Here are screenshots of the GWD setup for this example and the preview showing the product name has been changed dynamically:


Hope that helps,

Kent
Google Web Designer team
marked this as an answer
Helpful?
This question is locked and replying has been disabled.
Discard post? You will lose what you have written so far.
Write a reply
10 characters required
Failed to attach file, click here to try again.
Discard post?
You will lose what you have written so far.
Personal information found

We found the following personal information in your message:

This information will be visible to anyone who visits or subscribes to notifications for this post. Are you sure you want to continue?

A problem occurred. Please try again.
Create Reply
Edit Reply
Delete post?
This will remove the reply from the Answers section.
Notifications are off
Your notifications are currently off and you won't receive subscription updates. To turn them on, go to Notifications preferences on your Profile page.
Report abuse
Google takes abuse of its services very seriously. We're committed to dealing with such abuse according to the laws in your country of residence. When you submit a report, we'll investigate it and take the appropriate action. We'll get back to you only if we require additional details or have more information to share.

Go to the Legal Help page to request content changes for legal reasons.

Reported post for abuse
Unable to send report.
Report post
Questions about a different Google product are no longer considered off-topic and should be moved to the relevant community.
Google takes abuse of its services very seriously. We're committed to dealing with such abuse according to the laws in your country of residence. When you submit a report, we'll investigate it and take the appropriate action. We'll get back to you only if we require additional details or have more information to share.

Go to the Legal Help page to request content changes for legal reasons.

Reported post for abuse
Unable to send report.
This reply is no longer available.
/webdesigner/threads
//accounts.google.com/ServiceLogin
You'll receive email notifications for new posts at
Unable to delete question.
Unable to update vote.
Unable to update subscription.
You have been unsubscribed
Deleted
Unable to delete reply.
Removed from Answers
Marked as Recommended Answer
Removed recommendation
Undo
Unable to update reply.
Unable to update vote.
Thank you. Your response was recorded.
Unable to undo vote.
Thank you. This reply will now display in the answers section.
Link copied
Locked
Unlocked
Unable to lock
Unable to unlock
Pinned
Unpinned
Unable to pin
Unable to unpin
Marked
Unmarked
Unable to mark
Reported as off topic
/webdesigner/profile/0?hl=en