How can I create meta tags dynamically in BigCommerce?

by ervin.williamson , in category: SEO , a year ago

How can I create meta tags dynamically in BigCommerce?

Facebook Twitter LinkedIn Telegram Whatsapp Pocket

3 answers

Member

by virginie , a year ago

@ervin.williamson 

In BigCommerce, you can create meta tags dynamically by using a script to add the meta tags to your product or category pages. Here are the steps to create meta tags dynamically in BigCommerce:

  1. Create a script that will dynamically generate your meta tags. This script should pull information from your product or category pages to create the appropriate meta tags. You can use JavaScript to create this script.
  2. In the BigCommerce control panel, go to "Advanced Settings" > "Web Analytics".
  3. Click on the "Google Analytics" tab, and then click on the "Script Settings" button.
  4. In the "Head Section Scripts" section, paste your script that generates your meta tags.
  5. Save your changes.


Once you have completed these steps, your meta tags will be dynamically generated for your product or category pages. This will help improve your search engine optimization (SEO) and help search engines better understand the content on your site.

by naomi_cronin , 4 months ago

@ervin.williamson 

To provide a specific example, you can use the below JavaScript code to dynamically generate and update meta tags for a product page in BigCommerce:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
<script>
  var productName = '{{product.name}}'; // Replace with the appropriate variable for your product name
  var productDescription = '{{product.description}}'; // Replace with the appropriate variable for your product description
  var productPrice = '{{product.price}}'; // Replace with the appropriate variable for your product price

  document.querySelector('meta[name="title"]').setAttribute("content", productName);
  document.querySelector('meta[name="description"]').setAttribute("content", productDescription);
  document.querySelector('meta[property="og:title"]').setAttribute("content", productName);
  document.querySelector('meta[property="og:description"]').setAttribute("content", productDescription);
  document.querySelector('meta[property="og:price:amount"]').setAttribute("content", productPrice);
</script>


This script pulls the necessary information from the product page variables and dynamically updates the relevant meta tags (title, description, Open Graph (og) tags) accordingly.


Remember to replace the {{product.name}}, {{product.description}}, and {{product.price}} variables with the appropriate variables that retrieve the actual product name, description, and price from your BigCommerce store.


You can adapt this script to work on category pages or any other page where you want to dynamically generate meta tags in BigCommerce. Just make sure to modify the script to pull the necessary information from the appropriate variables or elements on the page.

Member

by jamison , 4 months ago

@ervin.williamson 

It's important to note that while dynamically generating meta tags can be beneficial for SEO, it's also recommended to manually optimize your meta tags for your most important pages. This ensures that you have control over the content and keywords you want to target. Additionally, it's a good practice to regularly review and update your meta tags based on your site's performance and any changes to your product or category pages.