DevHub Docs
  • Welcome
  • Analytics
    • What events are tracked automatically?
    • Custom events
    • Google Analytics
  • API documentation
  • Domains
    • Registering a new domain
    • Renewing a domain
    • Pointing an existing domain
    • Pointing a subdomain of an existing domain
    • Transfer a domain
      • Transfer a domain to another registrar
    • Validating your domain
      • Validate with Google Webmaster Tools
    • Domain expiration process
  • Email accounts
    • Hosted email (rackspace)
      • Configure email clients to use POP or IMAP
  • Forms
    • Form and field options
    • Using fieldsets
    • Spam filtering
    • Configure SMTP For outbound emails
    • Using Marketo forms
  • Google Sheets
  • Hosting options
    • Embed pages
    • Wordpress plugin for path override
    • Server path override
      • Apache configuration
      • IIS configuration
      • NGINX configuration
    • CDN (content delivery network) support
  • Maps
    • Location finder
    • Map options explained
    • Google Maps API keys
  • Privacy
    • OneTrust integration
    • Cookies
  • Reverse proxy
    • Privacy and security
    • Proxy Configuration
    • Proxy Gating
    • Form lead tracking
    • Blocking and Whitelisting
      • Whitelisting Options
      • Google Ads rejections or disapprovals
      • 3rd Party Services/Widgets
      • Common Security System Restrictions or Domain Errors
  • SEO
    • Schema.org support
    • Sitemap XML
    • Enable No Index
  • Site builder
    • Getting Started
    • Images and video
    • Pages and content
      • Using page drafts
      • Adding Text
      • Adding and Managing Pages
      • Adding Images
      • Page templates and Templated pages
      • Maps
    • Redirects
    • Site Settings
    • Style Options
    • Adding a Business and location
    • Adding a site
    • Adding a user
    • Adding Custom Forms
    • Adding HTML to Sites or Pages
    • Blogs
  • SSL and security
    • SSL Troubleshooting
    • SSL certificate install options
      • Use your own purchased SSL certificate
    • Enable HTTPS for Sites and Proxies
  • Support
    • Creating a Zendesk account
    • Ticketing submission workflow
    • Builder URL and Site ID
  • Themes and custom templates
    • Getting started
    • Using macros
    • Using custom fields
    • Using URL parameters
    • Hours of operation
    • Using date and time in templates
    • Template variables
    • Site Builder Markup
      • Avoiding Site Builder CSS and HTML duplication
    • Example themes
      • Location focused page with bootstrap
      • Store locator theme example
    • Advanced Examples
      • Theme module templates
      • Static Google maps
      • Content translations
      • Page navigation
      • Override page title and meta tags
      • Adding line breaks to content
      • Get objects
      • Handling boolean values
      • Right to left languages
      • Access current URL
      • Social sharing links
      • Standard filters
      • Serializing data to JSON
      • Form events
      • Schema.org FAQ utility
  • Trace technology
    • What is Trace?
    • Configuration options
  • Data Sources
    • External Contexts
Powered by GitBook
On this page
  • Overview
  • Options
  • Example External Context File
  • Configuration Settings
  • Using data within templates and themes

Was this helpful?

  1. Data Sources

External Contexts

Specifications on pulling in dynamic data for use in DevHub

Overview

An external data source can be configured to be used as a dynamic data source outside the normal data you would be entering into DevHub or Google Sheets tied to DevHub projects.

Options

  • Support for endpoints that support the following formats:

    • JSON

    • XML

    • Custom API clients (requires integration)

  • Passing of Site/Landing page IDs along on the external context URL

  • Passing of URL parameters (full path, partial path, UTM parameters) along on the external context URL

Example External Context File

Below is an example of a simple JSON External Context that contains a JSON list of products with a nested array of values for each product.

[
  {
    "product_id": 12345,
    "product_name": "Product 1",
    "price": "$55.99",
    "features": ["Feature 1", "Feature 2"],
    "images": {
      "large": "https://example.com/large-image.jpg",
      "small": "https://example.com/small-image.jpg"
    }
  },
  {
    "product_id": 54321,
    "product_name": "Product 2",
    "price": "$19.99",
    "features": ["Feature 3", "Feature 4"],
    "images": {
      "large": "https://example.com/large-image-2.jpg",
      "small": "https://example.com/small-image-2.jpg"
    }
  },
  ...
]

Configuration Settings

"EXTERNAL_CONTEXTS": [
  {
    "url": "http://sb-whitelabel.s3.amazonaws.com/product_feed.json",
    "key": "product_feed",
    "type": "json",
    "cache_time": 3600
  },
  {
    "url": "http://sb-whitelabel.s3.amazonaws.com/pricing_feed.json",
    "key": "pricing_feed",
    "type": "json",
    "cache_time": 3600
  }
]

Using data within templates and themes

Once configured, you will be able to access the External Context data from any Theme, HTML code module, or Template the same way you access other variables.

The key value on the External Context setting defines what variable that your data will be mapped to. In the case below, the product_feed variable was configured and the External Context was a list of products.

{% for product in product_feed %}
<div class="product">
  <h3>{{ product.product_name }}</h3>
  <p>{{ product.price }}</p>
</div>
{% endfor %}
PreviousConfiguration options

Last updated 5 years ago

Was this helpful?