• Skip to main content
  • Skip to primary sidebar
  • Skip to footer
  • Home
  • Categories
  • Contact Us
    • Advertising
    • Requests
    • Privacy Statement
HelpSpa.com

HelpSpa.com

Computer Tutorials

Convert LD+JSON Schema to Javascript to use in Google Tag Manager

April 21, 2020 by davidwank

The Solution to the LD+JSON GTM “schema not showing” Problem

For those of us who were used to pasting LD+JSON schema into a script tag in Google Tag Manager, we awoke one day to find out that this approach no longer worked.  Regardless of the reason why, you can still add your schema markup to GTM, but you have to wrap in in a Javascript function.
Remember, once you have the function, you still have to add it to GTM as a custom html tag.
The video below details how you do it (it’s easy), and below that is the code for you to copy to use:

<script>
(function(){
var data ={
// INSERT LD+JSON MARKUP HERE
};
var script = document.createElement('script');
script.type = 'application/ld+json';
script.innerHTML = JSON.stringify( data );
document.getElementsByTagName('head')[0].appendChild(script);
})(document);
</script>

Hat-tip to @simoahava for his advice on the tag manager product forum!

Filed Under: Google Analytics

Primary Sidebar

More to See

Convert LD+JSON Schema to Javascript to use in Google Tag Manager

April 21, 2020 By davidwank

How to Add Google Analytics Data to a LeadPages.com LeadPage

April 21, 2020 By davidwank

Footer

Text Widget

This is an example of a text widget which can be used to describe a particular service. You can also use other widgets in this location.

Examples of widgets that can be placed here in the footer are a calendar, latest tweets, recent comments, recent posts, search form, tag cloud or more.

Sample Link.

Recent

  • BackupBuddy Timeouts on GoDaddy Hosting
  • Convert LD+JSON Schema to Javascript to use in Google Tag Manager
  • How to Add Google Analytics Data to a LeadPages.com LeadPage
  • Diagnosing WordPress Errors with Apache Logs and PHP Logs
  • Setup Mailgun with cPanel and Google Apps

Search

Tags

Adobe Acrobat Backup classical music and opera cPanel DAM Database Digital Photography email Excel Facebook Firefox hardware HP Security HTML iMovie Internet Explorer iTunes linksys Microsoft Office Microsoft Word MySQL networking Office 2010 OneNote OpenOffice OS X PDF PHP printers reseller hosting Reviews router SEO subversion Video Virtualization Virtual PC Web Design Web Development Web Hosting Windows Windows 7 Windows Vista Windows XP Wireless

Copyright © 2021 · Magazine Pro on Genesis Framework · WordPress · Log in