Page properties through java script in source code

Avatar

Avatar
Validate 25
Level 4
varuns46785756
Level 4

Likes

22 likes

Total Posts

146 posts

Correct reply

2 solutions
Top badges earned
Validate 25
Validate 10
Validate 1
Ignite 5
Ignite 3
View profile

Avatar
Validate 25
Level 4
varuns46785756
Level 4

Likes

22 likes

Total Posts

146 posts

Correct reply

2 solutions
Top badges earned
Validate 25
Validate 10
Validate 1
Ignite 5
Ignite 3
View profile
varuns46785756
Level 4

30-07-2018

Hi,

For tracking purpose on different page , I need to display page properties( page title, tags, publication date) in source code of the page through javascript function.

My Client wants to add one javascript function on parent page and add variables for all three page propertie.By USE api I can handle this but how can i display the page properties by javascript in source code .

Something like this:

<script>

function tackingData() {

title: "Abc home page",

tags: "abcpagetag",

publisheddate: "2018-04-30T14:02:56.421Z"

}

</script>

Please suggest.

Regards,

View Entire Topic

Avatar

Avatar
Give Back
Level 1
shivamurthym775
Level 1

Like

1 like

Total Posts

8 posts

Correct reply

1 solution
Top badges earned
Give Back
Boost 1
Affirm 1
View profile

Avatar
Give Back
Level 1
shivamurthym775
Level 1

Like

1 like

Total Posts

8 posts

Correct reply

1 solution
Top badges earned
Give Back
Boost 1
Affirm 1
View profile
shivamurthym775
Level 1

30-07-2018

You can use the properties object directly in the script

<script>

function tackingData() {

title: "${properties.propertyname}",

tags: "${properties.propertyname}",

publisheddate: "${properties.propertyname}"

}

</script>

and put this in any html and make a data-sly-include of that html in head.html of page component.