BigCommerce App Development: Mastering Dynamic Meta Tags and Usage-Based Billing
Navigating BigCommerce App Development: Dynamic Meta Tags and Flexible Billing
Developing robust applications for the BigCommerce ecosystem often involves unique technical and business challenges. This community thread, initiated by Sawyer Irwin, highlights two critical areas for app developers: programmatically injecting meta verification tags into the storefront's and implementing flexible usage-based billing models.
Challenge 1: Injecting Meta Verification Tags
Sawyer's primary goal was to enable their BigCommerce app to automatically add essential meta verification tags (e.g., for Google or Microsoft) to the storefront's section on all pages. Their initial attempt using the Scripts API failed when trying to inject raw tags, receiving a 422 error indicating invalid HTML.
The BigCommerce Platform Limitation
As confirmed by Sajid Jameel from Codinative.com and Sri Vathson, the BigCommerce Scripts API is designed to accept only tags in its HTML field, not direct tags. This is a crucial platform limitation for app developers.
Solution: JavaScript Workaround via Scripts API
The recommended and most effective workaround for apps, provided by Sajid Jameel, involves using a tag to dynamically append the tag to the at runtime. This method leverages the Scripts API's intended functionality while achieving the desired outcome.
POST https://api.bigcommerce.com/stores/{store_hash}/v3/content/scripts
{
"name": "Google Site Verification",
"description": "Injects google-site-verification meta tag",
"html": "