Dynamic text replacement: useful content types

Hey There

I am using Gatsbyjs + Contentful for our Landing Pages. I now want to implement dynamic text replacement to adjust text and pictures on my website based on my url query string (similar to https://documentation.unbounce.com/hc/en-us/articles/203661004-Working-with-Dynamic-Text-Replacement).

Has anyone here worked on a similar problem before and can tell me if there is specific content types or a custom setup of content types that can help me solve that?

I would be grateful for any ideas.

This seems like you would want to have a specific content type maybe called dynamic text that has 2 fields:

  • a URL Parameter short text field
  • a Default Text short text field

and then anywhere you want to put one of the dynamic text replacements you’d add an entry of the dynamic text content type (perfect for inline embedded entries in a rich text field).

Last, you’d need to have rendering logic or a component on the front end that when encountering a dynamic text entry from Contentful would check the URL for the URL parameter as defined and, if found, show the value specified in the URL, but if not found, show the default value as defined in Contentful.

This is something you can do with the Ninetailed Personalization app from the Contentful marketplace (it has a free tier!).

With this app you can create within Contentful dynamic variants and show them to visitors with a specific url query string. You can also create dynamic text replacement (or merge tags).

Integrating Ninetailed in a Gatbsy + Contentful website is straight forward - there is a specific Gatsby plugin available.