Custom targeting not working on string attribute without double quotes

Please fill out as many of the following questions as possible so we can help you promptly! If you don’t know how to answer or it does not apply, feel free to remove it or leave it blank.

Builder content link
e.g. builder.io/content/4cab34394e684fe7b93d6ef5493a8a51

Builder public api key
a2b42a9cc9b6477aa448a90e48b7600f

What are you trying to accomplish
I’m trying to target content based on some custom targeting attributes. The API works fine, since I’m able to retrieve the content using production key (5820616af7ee4c0981776e26cbaa820c), but the same API doesn’t work when trying with QA key (a2b42a9cc9b6477aa448a90e48b7600f)

Here’s the API link that I’m using:
https://builder.io/api/v1/html/page?apiKey=a2b42a9cc9b6477aa448a90e48b7600f&url=/shop-book-experience&fields=id,name,query,data,canonicalUrl,metaRobots&userAttributes.dub=332

dub is configured as a string. I figured out the root cause, if I use double quotes around the value, it works. But wanted to check why is that the case?

Code stack you are integrating Builder with
Custom application

Reproducible code example
https://builder.io/api/v1/html/page?apiKey=a2b42a9cc9b6477aa448a90e48b7600f&url=/shop-book-experience&fields=id,name,query,data,canonicalUrl,metaRobots&userAttributes.dub=332

@venbommineni Do you have a code example you could share where it is not working?

If the targeting attribute is configured as a string, then the API will expect, and only accept, a string. If you pass a number with “” it will pass as a string, but without the “” it will be a number, and so it would be expected to fail.

Does that answer your question? Let me know if there is anything else I can help to clarify !

Thanks, Tim.

That makes sense. Is there a way to configure integer attributes?

@venbommineni currently we do not have support for integer type tracking attribute. We have a card for it in our backlog and hope to get to it shortly, but in the meantime hopefully the work around of double quotes is enough? Let us know if this becomes a blocker or you have further use cases that this is critical for!

Side note, not sure if you have seen our feature request platform: ideas.builder.io

If this or any other issue/feature request becomes a blocker, feel free to add it to the ideas board. Users can vote on submissions and our team uses these cards to inform our product development, I recommend you check it out!

1 Like