Created
December 4, 2019 15:31
-
-
Save otarsko/e4f0eff1996871136423ebbc604d6721 to your computer and use it in GitHub Desktop.
Adobe Experience Cloud without AEM | Datalayer component
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from 'react'; | |
export default class DataLayer extends React.Component { | |
constructor(props) { | |
super(props); | |
} | |
render() { | |
return ( | |
<></> | |
) | |
} | |
componentDidMount() { | |
const { pageTitle, pageType, pagePath } = this.props; | |
{ | |
window.digitalData = { | |
page: { | |
pageInfo: { | |
pageName: pageTitle, | |
pageType: pageType, | |
pagePath: pagePath | |
} | |
} | |
} | |
var event = new CustomEvent('datalayer-complete'); | |
var obj = document.querySelector("body"); | |
obj.dispatchEvent(event); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment