Possibillity to use Javascript files in ads



Possibility to Apply Javascript in Ads

Hi Twitter,

I am a developer and am planning to create Proof of Concept for Ad campaign in twitter. In the process, i came up with a question that i would like to ask.
When creating ad in twitter, is it possible to dynamically change the text using some sort of javascript applied?
What i would like to achieve is like this:

  • Say i want to make a “Website Clicks or Conversions” ad with the text “shop now for only $5” on the description
  • Normally i would need to hardcodedly type the text. But, i want to make the price dynamic by using some sort of javascript. e.g “shop now for only [PRODUCT_PRICE]”, with the value of [PRODUCT_PRICE] came from a javascript that i have

Any information on this would be very helpful. Thank you very much in advance.


Hi @radityo_pradana! You can certainly not use your own javascript code in ads - that would be a huge security risk! So that’s a no-no. The only possibility for this would be if Twitter itself would provide something like dynamic ads, like Google AdWords does, where the text of your ad would change from one version to another (versions that you provide beforehand) based on user search terms or other user actions. But as far as I know, Twitter doesn’t offer this option.


Hi majoritasdev,

Thank you very much for the information. I see that using own Javascript would be risky for the security aspect, and twitter doesn’t currently offer the option to do this. One more question that i have, how about if i have REST API to be applied to achieve what i mentioned above? is it also not possible or there is a way to do it?

Thank you very much for the support.


That’s kind of the same thing, so no, there’s no way you can do that. The ad once created, it’s fixed.