Skip to content

Instantly share code, notes, and snippets.

View gabrielwalt's full-sized avatar

Gabriel Walt gabrielwalt

View GitHub Profile
@gabrielwalt
gabrielwalt / sling:configs.json
Last active February 22, 2024 11:11
Frontend module configuration below /conf/SITENAME/sling:configs.json
{
"jcr:primaryType": "nt:unstructured",
"com.adobe.aem.wcm.site.manager.config.SiteConfig": {
"jcr:primaryType": "nt:unstructured",
"themePackageName": "SITENAME-theme"
},
"com.adobe.cq.wcm.core.components.config.HtmlPageItemsConfig": {
"jcr:primaryType": "nt:unstructured",
"prefixPath": "/content/SITENAME.theme/_default",
"css": {
@gabrielwalt
gabrielwalt / script.js
Last active April 23, 2021 09:25
Generic Core Component ACDL event tracking
// The following function generates an event handler that returns the eventInfo.path, and allows to filter events by properties.
function getEventPathHandler(callback, filter) {
return function (eventData) {
if (eventData.hasOwnProperty("eventInfo") && eventData.eventInfo.hasOwnProperty("path")) {
const eventObject = this.getState(eventData.eventInfo.path);
if (eventObject != null) {
for (const property in filter) {
if (!eventObject.hasOwnProperty(property) || (filter[property] !== null && filter[property] !== eventObject[property])) {
return;
}
@gabrielwalt
gabrielwalt / acdl-test6.js
Created April 16, 2021 13:41
ACDL eventing, manually tracking the variables with generic event
// In a browswer window with URL about:blank
// Open the JS console and paste this code
window.adobeDataLayer = [];
adobeDataLayer.push({
event: "test-x",
x: 1
});
adobeDataLayer.push({
@gabrielwalt
gabrielwalt / acdl-test1.js
Last active April 16, 2021 13:45
ACDL eventing with getState
// In a browswer window with URL about:blank
// Open the JS console and paste this code
window.adobeDataLayer = [];
adobeDataLayer.push(function (dl) {
dl.addEventListener("test", function() {
console.log(dl.getState());
});
});
@gabrielwalt
gabrielwalt / acdl-test5.js
Last active April 16, 2021 13:46
ACDL eventing, manually tracking the variables
// In a browswer window with URL about:blank
// Open the JS console and paste this code
window.adobeDataLayer = [];
adobeDataLayer.push({
event: "test",
x: 1
});
adobeDataLayer.push({
@gabrielwalt
gabrielwalt / acdl-test4.js
Last active April 16, 2021 13:46
ACDL eventing with built-in change event
// In a browswer window with URL about:blank
// Open the JS console and paste this code
window.adobeDataLayer = [];
adobeDataLayer.push({
x: 1
});
adobeDataLayer.push({
event: "test",
@gabrielwalt
gabrielwalt / acdl-test3.js
Last active April 16, 2021 13:46
ACDL eventing with event parameter
// In a browswer window with URL about:blank
// Open the JS console and paste this code
window.adobeDataLayer = [];
adobeDataLayer.push({
x: 1
});
adobeDataLayer.push({
event: "test",
@gabrielwalt
gabrielwalt / acdl-test2.js
Last active April 19, 2021 09:32
ACDL eventing with getState registered late
// In a browswer window with URL about:blank
// Open the JS console and paste this code
window.adobeDataLayer = [];
adobeDataLayer.push({
x: 1
});
adobeDataLayer.push({
event: "test",
#!/bin/bash
mvn archetype:generate \
-DarchetypeGroupId=com.adobe.granite.archetypes \
-DarchetypeArtifactId=aem-project-archetype \
-DarchetypeVersion=22 \
-DgroupId=org.myorg \
-DartifactId=mysite \
-DartifactName="My Site" \
-Dversion=0.0.1-SNAPSHOT \
-Dpackage=org.myorg.mysite \
@gabrielwalt
gabrielwalt / code.md
Last active June 8, 2018 23:05
HTL Code Samples from Immerse 2017

1. Use statement

template.html

<sly data-sly-use.logic="logic.js">
    <h1>${logic.pageTitle}</h1>
</sly>