Transcript
Page 1: Implementing schema.org in the JSON-LD format with Google Tag Manager

@rebelytics

Implementing schema.orgin the JSON-LD format

with Google Tag Manager

Page 2: Implementing schema.org in the JSON-LD format with Google Tag Manager

@rebelytics

Implementing schema.orgin the JSON-LD format

with Google Tag Manager

Page 3: Implementing schema.org in the JSON-LD format with Google Tag Manager

@rebelytics@rebelytics

Implementing schema.orgin the JSON-LD format

with Google Tag Manager

Page 4: Implementing schema.org in the JSON-LD format with Google Tag Manager

@rebelytics

Schema.org is a vocabulary for structured data

@rebelytics

Page 5: Implementing schema.org in the JSON-LD format with Google Tag Manager

@rebelytics

schema.org can be used to describe:

Page 6: Implementing schema.org in the JSON-LD format with Google Tag Manager

@rebelytics

entities

@rebelytics

Page 7: Implementing schema.org in the JSON-LD format with Google Tag Manager

@rebelytics

relationships relationships

@rebelytics

Page 8: Implementing schema.org in the JSON-LD format with Google Tag Manager

@rebelytics

and actions

@rebelytics

Page 9: Implementing schema.org in the JSON-LD format with Google Tag Manager

@rebelytics

schema.org was founded byGoogle, Microsoft, Yahoo & Yandex

@rebelytics

Page 10: Implementing schema.org in the JSON-LD format with Google Tag Manager

@rebelytics

schema.org can be used in e-mails,

Page 11: Implementing schema.org in the JSON-LD format with Google Tag Manager

@rebelytics

on websites,

Page 12: Implementing schema.org in the JSON-LD format with Google Tag Manager

@rebelytics

and with all other types of documents.

Page 13: Implementing schema.org in the JSON-LD format with Google Tag Manager

@rebelytics

schema.org is a vocabulary, so

https://schema.org/ is our dictionary.

There’s no need to memorise any of it.

Page 14: Implementing schema.org in the JSON-LD format with Google Tag Manager

@rebelytics

Here’s an example for a page in our dictionary.

Page 15: Implementing schema.org in the JSON-LD format with Google Tag Manager

@rebelytics

Our dictionary provides us with detailed information about the properties we can use to describe each entity

and the values that these properties can take.

Page 16: Implementing schema.org in the JSON-LD format with Google Tag Manager

@rebelytics

Implementing schema.orgin the JSON-LD format

with Google Tag Manager

Page 17: Implementing schema.org in the JSON-LD format with Google Tag Manager

@rebelytics@rebelytics

Implementing schema.orgin the JSON-LD format

with Google Tag Manager

Page 18: Implementing schema.org in the JSON-LD format with Google Tag Manager

@rebelytics

JSON-LD is one of several formats that can be

used to encode schema.org

Page 19: Implementing schema.org in the JSON-LD format with Google Tag Manager

@rebelytics

Advantage of JSON-LD:

Does not have to be embedded into existing code

> easier to read & implement

@rebelytics

Page 20: Implementing schema.org in the JSON-LD format with Google Tag Manager

@rebelytics

JSON-LD in a separate script Microdata included in HTML tags

Page 21: Implementing schema.org in the JSON-LD format with Google Tag Manager

@rebelytics

Implementing schema.orgin the JSON-LD format

with Google Tag Manager

Page 22: Implementing schema.org in the JSON-LD format with Google Tag Manager

@rebelytics@rebelytics

Implementing schema.orgin the JSON-LD format

with Google Tag Manager

Page 23: Implementing schema.org in the JSON-LD format with Google Tag Manager

@rebelytics

Google Tag Manager allows us to easily add

JSON-LD scripts to all pages on a website

Page 24: Implementing schema.org in the JSON-LD format with Google Tag Manager

@rebelytics

Values can be populated with the help of

Google Tag Manager variables

Page 25: Implementing schema.org in the JSON-LD format with Google Tag Manager

@rebelytics

This means: One script for thousands of

pages with the same data type

Page 26: Implementing schema.org in the JSON-LD format with Google Tag Manager

@rebelytics

Implementing schema.orgin the JSON-LD format

with Google Tag Manager

Page 27: Implementing schema.org in the JSON-LD format with Google Tag Manager

@rebelytics

Let’s do it!

@rebelytics

Page 28: Implementing schema.org in the JSON-LD format with Google Tag Manager

@rebelytics@rebelytics

What we need to doStep by step

Page 29: Implementing schema.org in the JSON-LD format with Google Tag Manager

@rebelytics

5 simple steps

1. Pick a data type that we want to implement on a certain page type

Page 30: Implementing schema.org in the JSON-LD format with Google Tag Manager

@rebelytics

5 simple steps

1. Pick a data type that we want to implement on a certain page type

2. Create a JSON-LD script with the properties we want to describe

Page 31: Implementing schema.org in the JSON-LD format with Google Tag Manager

@rebelytics

5 simple steps

1. Pick a data type that we want to implement on a certain page type

2. Create a JSON-LD script with the properties we want to describe

3. Create the GTM variables we need for the values we want to include

Page 32: Implementing schema.org in the JSON-LD format with Google Tag Manager

@rebelytics

5 simple steps

1. Pick a data type that we want to implement on a certain page type

2. Create a JSON-LD script with the properties we want to describe

3. Create the GTM variables we need for the values we want to include

4. Create a GTM tag that injects the JSON-LD script with the values into the page

Page 33: Implementing schema.org in the JSON-LD format with Google Tag Manager

@rebelytics

5 simple steps

1. Pick a data type that we want to implement on a certain page type

2. Create a JSON-LD script with the properties we want to describe

3. Create the GTM variables we need for the values we want to include

4. Create a GTM tag that injects the JSON-LD script with the values into the page

5. Debugging and testing

Page 34: Implementing schema.org in the JSON-LD format with Google Tag Manager

@rebelytics@rebelytics

Step 1Pick a data type that we want to

implement on a certain page type

Page 35: Implementing schema.org in the JSON-LD format with Google Tag Manager

@rebelytics

Google’s Search Gallery is a good starting point

to find data types that are supported by Google

https://developers.google.com/search/docs/guides/search-gallery

Page 36: Implementing schema.org in the JSON-LD format with Google Tag Manager

@rebelyticshttps://developers.google.com/search/docs/guides/search-gallery

Page 37: Implementing schema.org in the JSON-LD format with Google Tag Manager

@rebelytics

But: There’s no need to limit yourself to what Google supports

Page 38: Implementing schema.org in the JSON-LD format with Google Tag Manager

@rebelytics

But: There’s no need to limit yourself to what Google supports

➔ Google will certainly support more data types and properties in future

Page 39: Implementing schema.org in the JSON-LD format with Google Tag Manager

@rebelytics

But: There’s no need to limit yourself to what Google supports

➔ Google will certainly support more data types and properties in future

➔ Other machines process and use structured data

Page 40: Implementing schema.org in the JSON-LD format with Google Tag Manager

@rebelytics

But: There’s no need to limit yourself to what Google supports

➔ Google will certainly support more data types and properties in future

➔ Other machines process and use structured data

Let’s start with an example!

Page 41: Implementing schema.org in the JSON-LD format with Google Tag Manager

@rebelytics

Google supports social profile

links for the data types Person

and Organization.

Page 42: Implementing schema.org in the JSON-LD format with Google Tag Manager

@rebelytics

Let’s have a look at what markup Google

suggests for the data type Person.

Page 43: Implementing schema.org in the JSON-LD format with Google Tag Manager

@rebelytics

Google suggests marking up the name of the person, a

URL that represents the person, and links to social profiles.

Page 44: Implementing schema.org in the JSON-LD format with Google Tag Manager

@rebelytics

➔ On our example page, we

also have job title, phone

and fax numbers, email

address, postal address,

languages spoken, etc.

➔ All of the above are

supported by schema.org:

https://schema.org/Person

Page 45: Implementing schema.org in the JSON-LD format with Google Tag Manager

@rebelytics@rebelytics

Page 46: Implementing schema.org in the JSON-LD format with Google Tag Manager

@rebelytics

Let’s mark up everything that’s on the page and supported by schema.org:

➔ address➔ e-mail➔ fax number➔ image➔ job title➔ name➔ telephone➔ url➔ works for ...➔ social profile links

Page 47: Implementing schema.org in the JSON-LD format with Google Tag Manager

@rebelytics@rebelytics

Step 2Create a JSON-LD script with the

properties we want to describe

Page 48: Implementing schema.org in the JSON-LD format with Google Tag Manager

@rebelytics

How I do it: Copy an example script from

Google’s Search Gallery and manually

adjust and expand it.

Page 49: Implementing schema.org in the JSON-LD format with Google Tag Manager

@rebelytics

The values here are represented by GTM variables, which leads us to the next step: Creating the Google Tag Manager variables we need.

Tool tip:https://technicalseo.com/seo-tools/schema-markup-generator/

Page 50: Implementing schema.org in the JSON-LD format with Google Tag Manager

@rebelytics@rebelytics

Step 3Create the GTM variables we need for the values we want to include

Page 51: Implementing schema.org in the JSON-LD format with Google Tag Manager

@rebelytics

GTM variables

➔ On our example website, we have thousands of lawyer profile pages

Page 52: Implementing schema.org in the JSON-LD format with Google Tag Manager

@rebelytics

GTM variables

➔ On our example website, we have thousands of lawyer profile pages

➔ We can’t create an individual script for each page, so we use one script for all

pages and add the values dynamically with GTM variables

Page 53: Implementing schema.org in the JSON-LD format with Google Tag Manager

@rebelytics

GTM variables

➔ On our example website, we have thousands of lawyer profile pages

➔ We can’t create an individual script for each page, so we use one script for all

pages and add the values dynamically with GTM variables

➔ For this implementation, there are two variable types we can choose from:

◆ DOM element variables

◆ Data layer variables

Page 54: Implementing schema.org in the JSON-LD format with Google Tag Manager

@rebelytics

Option 1: DOM element variables

➔ DOM element variables can be used to extract elements from pages using

CSS selectors

https://www.w3schools.com/cssref/css_selectors.asp

Page 55: Implementing schema.org in the JSON-LD format with Google Tag Manager

@rebelytics

➔ You can identify the CSS selector of an element using Chrome’s Developer Tools (Right click on element > Inspect > Right click on selected HTML > Copy > Copy selector)

Option 1: DOM element variables

Page 56: Implementing schema.org in the JSON-LD format with Google Tag Manager

@rebelytics@rebelytics

Page 57: Implementing schema.org in the JSON-LD format with Google Tag Manager

@rebelytics

Page 58: Implementing schema.org in the JSON-LD format with Google Tag Manager

@rebelytics

This variable extracts the name of the lawyer from the example page

using a CSS selector

Page 59: Implementing schema.org in the JSON-LD format with Google Tag Manager

@rebelytics

This variable extracts the name of the lawyer from the example page

using a CSS selector

@rebelytics

Page 60: Implementing schema.org in the JSON-LD format with Google Tag Manager

@rebelytics

Option 2: Data layer variables

➔ The data layer is a JavaScript object on the page that contains information

that can be accessed by Google Tag Manager

Page 61: Implementing schema.org in the JSON-LD format with Google Tag Manager

@rebelytics

Option 2: Data layer variables

➔ The data layer is a JavaScript object on the page that contains information

that can be accessed by Google Tag Manager

➔ The data layer is useful for lots of different applications, for example

Enhanced Ecommerce Tracking with Google Analytics

Page 62: Implementing schema.org in the JSON-LD format with Google Tag Manager

@rebelytics

Option 2: Data layer variables

➔ The data layer is a JavaScript object on the page that contains information

that can be accessed by Google Tag Manager

➔ The data layer is useful for lots of different applications, for example

Enhanced Ecommerce Tracking with Google Analytics

➔ The data layer normally has to be set up on the website itself and not

through Google Tag Manager

Page 63: Implementing schema.org in the JSON-LD format with Google Tag Manager

@rebelytics

In our example, we pass some of the data that we cannot extract

with the help of DOM element variables via the data layer

Page 64: Implementing schema.org in the JSON-LD format with Google Tag Manager

@rebelytics

We can then create a data layer variable in Google

Tag Manager for each value we want to access

Page 65: Implementing schema.org in the JSON-LD format with Google Tag Manager

@rebelytics

On our example page, we use a

combination of DOM element

and data layer variables to

populate the JSON-LD script

Page 66: Implementing schema.org in the JSON-LD format with Google Tag Manager

@rebelytics@rebelytics

Step 4Create a GTM tag that injects the JSON-LD

script with the values into the page

Page 67: Implementing schema.org in the JSON-LD format with Google Tag Manager

@rebelytics

Page 68: Implementing schema.org in the JSON-LD format with Google Tag Manager

@rebelytics

➔ A few simple additional lines of jQuery

inject the script into the head of the

page

Page 69: Implementing schema.org in the JSON-LD format with Google Tag Manager

@rebelytics@rebelytics

Step 5Debugging and testing

Page 70: Implementing schema.org in the JSON-LD format with Google Tag Manager

@rebelytics

We can now publish this and test it with Google’s

Structured Data Testing Tool (https://search.google.com/structured-data/testing-tool/u/0/)

Page 71: Implementing schema.org in the JSON-LD format with Google Tag Manager

@rebelytics

No errors, no warnings,

Google is happy :)

Page 72: Implementing schema.org in the JSON-LD format with Google Tag Manager

@rebelytics

A few days after publishing, we can also check

Google Search Console to see if the data has been

processed correctly

Page 73: Implementing schema.org in the JSON-LD format with Google Tag Manager

@rebelytics@rebelytics

Page 74: Implementing schema.org in the JSON-LD format with Google Tag Manager

@rebelytics@rebelytics

Page 75: Implementing schema.org in the JSON-LD format with Google Tag Manager

@rebelytics

Implementing schema.orgin the JSON-LD format

with Google Tag Manager

Page 76: Implementing schema.org in the JSON-LD format with Google Tag Manager

@rebelytics

Really easy, isn’t it?

➔ You can use the exact same steps for all other data types: Breadcrumbs, Sitelinks

Searchbox, Events, Jobs, Articles, Products, etc.

Page 77: Implementing schema.org in the JSON-LD format with Google Tag Manager

@rebelytics

Really easy, isn’t it?

➔ You can use the exact same steps for all other data types: Breadcrumbs, Sitelinks

Searchbox, Events, Jobs, Articles, Products, etc.

➔ For some of the simpler data types, you won’t even need GTM variables

Page 78: Implementing schema.org in the JSON-LD format with Google Tag Manager

@rebelytics

Really easy, isn’t it?

➔ You can use the exact same steps for all other data types: Breadcrumbs, Sitelinks

Searchbox, Events, Jobs, Articles, Products, etc.

➔ For some of the simpler data types, you won’t even need GTM variables

➔ For ecommerce sites, you can even use the same data layer values for Enhanced

Ecommerce Tracking and product JSON-LD

Page 79: Implementing schema.org in the JSON-LD format with Google Tag Manager

@rebelytics@rebelytics

Two more examples

Page 80: Implementing schema.org in the JSON-LD format with Google Tag Manager

@rebelytics

JSON-LD for event pages

Page 81: Implementing schema.org in the JSON-LD format with Google Tag Manager

@rebelytics

JSON-LD for job postings

Page 82: Implementing schema.org in the JSON-LD format with Google Tag Manager

@rebelytics@rebelytics

Some warnings before you do it

yourself

Page 83: Implementing schema.org in the JSON-LD format with Google Tag Manager

@rebelytics

➔ Not everybody supports JSON-LD yet

Page 84: Implementing schema.org in the JSON-LD format with Google Tag Manager

@rebelytics

➔ JSON-LD implemented with

Google Tag Manager is only

accessible for programmes

that render the page and

execute the GTM script

Page 85: Implementing schema.org in the JSON-LD format with Google Tag Manager

@rebelytics

➔ Even if Google Tag Manager is often the easiest way to implement things on a

page, it is not always the best way. Speak to your dev team first.

@rebelytics

Page 86: Implementing schema.org in the JSON-LD format with Google Tag Manager

@rebelytics

➔ DOM element variables are not very stable, as CSS selectors may change over time.

Page 87: Implementing schema.org in the JSON-LD format with Google Tag Manager

@rebelytics@rebelytics

The end Get in contact:

twitter.com/rebelytics

[email protected]

linkedin.com/in/eoghanhenn/


Top Related