Expand my Community achievements bar.

SOLVED

Issue while fetching aem contexthub dataelement in DTM for triggering some alert event

Avatar

Level 3

Hello Experts, I am new to DTM world and following dtm.pdf for implementing an event based rule which is triggered by the dataelement value change of aem contexthub data element. The step by step example is given in standard dtm.pdf at page# 52 onward.

Issue:

  1. As per the instructions, I've created a dataelement in DTM which is reading cart.totalPriceFloat contexthub variable. Another eventbased rule is monitoring the dataelementchanged action of this dataelement. All propety, AEMcontexthub tool, dataelement rule and event rules are activated properly. But on changing cart.totalPriceFloat from contexthub, DTM is not triggering the alert as per the rule. While if I check the variable value in contexthub using console command - ContextHub.getItem("/store/cart").totalPriceFloat; it is updating properly.
  2. I tried to setup a page load rule for showing some alert, it is working perfectly fine.
  3. Another issue I observed, my satellite library is not loading in browser. If I hit the below console command - _satellite.settings.notifications = true; it returns "VM7955:1 Uncaught ReferenceError: _satellite is not defined".
  4. I followed all steps to configure my header and footer based on stg values as mentioned in the article https://helpx.adobe.com/dtm/kb/why-do-i-see-satellite-is-not-defined-in-my-console.html but still it is not loading. I am not finding any keyword specific to satellite in the view source of my page.

 

I believe, issue mentioned in step#1 is related with issue mentioned in point# 3. Please provide any pointer to resolve the issue, it would be great help. Thanks - DJ

1 Accepted Solution

Avatar

Correct answer by
Level 10

Hi  Deepak ,

Ideally "_satellite not defined"  is encountered only when the Header Code doesn't get properly loaded on the page or referenced at the incorrect location. Can you please share the URL of your Website as well as DTM account details in a private message so that we can debug the issue at our end.

Thanks & Regards

Parit Mittal

View solution in original post

13 Replies

Avatar

Administrator

Hi 

I am moving this question to DTM forum.

There more DTM expert could help you in answering this question.

~kautuk



Kautuk Sahni

Avatar

Correct answer by
Level 10

Hi  Deepak ,

Ideally "_satellite not defined"  is encountered only when the Header Code doesn't get properly loaded on the page or referenced at the incorrect location. Can you please share the URL of your Website as well as DTM account details in a private message so that we can debug the issue at our end.

Thanks & Regards

Parit Mittal

Avatar

Level 3

ParitMittal wrote...

Hi  Deepak ,

Ideally "_satellite not defined"  is encountered only when the Header Code doesn't get properly loaded on the page or referenced at the incorrect location. Can you please share the URL of your Website as well as DTM account details in a private message so that we can debug the issue at our end.

Thanks & Regards

Parit Mittal

 

Thanks Parit!

I am able to fix the "_satellite not defined" after setting up DTM embed header and footer in my AEM DTM couldservice configuration. That issue has been resolved now.

However, I am exploring the AEM ContextHub stores and how the store dataelements can trigger the DTM events. I am able to trigger a DTM event on dataelementchanged condition using default out of the box "commerce.cart" store. Now, I want to customize the store or want to create a new custom store with my own variable say "empid" and want to trigger same event. 

Could you please suggest/point -

  1. How I can create a custom store?
  2. How I can generate the JSON specific contexthub object for this store? 

It would be great help, thanks in advance!!

Avatar

Level 10

Hi  Deepak ,

Thanks for letting us know.  As per our understanding , You want to use AEM ContextHub tool that references and uses a custom, non-ContextHub data layer within the Dynamic Tag Management configuration. Please see the below link for information on creating non-ContextHub data layer 

https://marketing.adobe.com/resources/help/en_US/dtm/c_custom-data-layer-example.html

Thanks & Regards

Parit Mittal

Avatar

Level 3

Thanks Parit for sharing the link, it is very helpful. Though, I am referencing the link but still facing some challenges while triggering the dataelementchanged event on my custom data element. Please check the attached word document to see the steps I am following.

 

Please suggest if I need to perform some step differently, it would be great help. Thanks!

 

"store.session-store.js" for reference - 

ContextHub.console.log(ContextHub.Shared.timestamp(), '[loading] contexthub.store.demo.01-session-store - store.session-store.js');

(function($) {
    'use strict';

    /* default config */
    var defaultConfig = {
        /* initial values to set in store's storage */
        initialValues: {
            name: 'Alison Parker',
            age: 22
        }
    };

    /**
     * Store implementation.
     *
     * @extends ContextHub.Store.SessionStore
     * @param {String} name - store name
     * @param {Object} config - config
     * @constructor
     */
    var TestStore = function(name, config) {
        this.config = $.extend(true, {}, defaultConfig, config);
        this.init(name, this.config);
    };

    /* inherit from ContextHub.Store.SessionStore */
    ContextHub.Utils.inheritance.inherit(TestStore, ContextHub.Store.SessionStore);

    /**
     * Returns name.
     *
     * @return {String}
     */
    TestStore.prototype.getName = function() {
        return this.getItem('name') || '[unknown]';
    };

    /**
     * Returns age.
     *
     * @return {Number}
     */
    TestStore.prototype.getAge = function() {
        return this.getItem('age') || '[unknown]';
    };

    /* register store candidate */
    ContextHub.Utils.storeCandidates.registerStoreCandidate(TestStore, 'demo.01-session-store', 0);

}(ContextHubJQ));

Avatar

Level 3

ParitMittal wrote...

Hi  Deepak ,

Thanks for letting us know.  As per our understanding , You want to use AEM ContextHub tool that references and uses a custom, non-ContextHub data layer within the Dynamic Tag Management configuration. Please see the below link for information on creating non-ContextHub data layer 

https://marketing.adobe.com/resources/help/en_US/dtm/c_custom-data-layer-example.html

Thanks & Regards

Parit Mittal

 

Hi Parit, Please suggest, waiting for your response on my below post. Thanks!

Avatar

Level 10

Hi Deepak ,

We are looking into your query and will get back to you ASAP.

Thanks & Regards

Parit Mittal

Avatar

Level 3

Thanks Parit, I know you'll definitely provide some solution. Just requesting, please go through the attached word document and "store.session-store.js" that will provide more insight. Thanks in advance!

Avatar

Level 10

Hi Deepak,

If the custom data layer is a modification of the ContextHub schema be sure to add “ContextHub” in the Data Layer Root field.

Also, The schema you are providing is incorrect . The schema for your  data layer will be like :

{ "$schema": "http://json-schema.org/draft-04/schema#", "type": "object", "properties": { "01-session-store": { "type": "object", "properties": { "name": { "type": "string" }, "age": { "type": "number" } }, "required": ["name","age"] } } }

Rest of the things are good to go. I hope issues will be resolved after making above changes.

Thanks & Regards

Parit Mittal

Avatar

Level 3

Thanks Parit for quick help, let me follow the instructions. I'll get back to you with result. Thanks a lot!

Avatar

Level 3

Hi Parit,

Thank you very much, I am able to trigger the event in DTM based on the value change in custom variable at context hub. You are right, I was making mistake while giving the custom schema during context hub tool creation in DTM.

But, there was a small issue and need your input to fix that -

I customized the OOTB schema means added my custom section in existing JSON. I selected the "Customized ContextHub Data layer" and entered this correct JSON schema in DTM. After successful activation/approval my site page should started showing DTM alerts based on the rule. Instead, the OOTB rules also stopped working including custom data element event.

I just reverted back my integration method from "Customized ContextHub Data layer" to "Use Default ContextHub data layer" and it fixed the issue. Both OOTB and Custom events started firing without any issue? - Do you have any insight if there is any issue because I changed the configuration back to default one but, events are working?

Another thing, I would like to know - I am using Akamai as hosting. Any kind of change in Java script is showing instantly without any caching issue. But, sometime my alerts are showing twice. Double checked if I had created same rule in another property but there is no such case. Please guide on this issue as well. 

Thanks again!!!

Avatar

Level 10

Hi Deepak ,

 Can you please share the URL of your website as well as DTM account details in a private message so that we can debug the issue at our end.

Thanks & Regards

Parit Mittal

Avatar

Level 3

ParitMittal wrote...

Hi Deepak,

If the custom data layer is a modification of the ContextHub schema be sure to add “ContextHub” in the Data Layer Root field.

Also, The schema you are providing is incorrect . The schema for your  data layer will be like :

  1. {
  2. "$schema": "http://json-schema.org/draft-04/schema#",
  3. "type": "object",
  4. "properties": {
  5. "01-session-store": {
  6. "type": "object",
  7. "properties": {
  8.  
  9. "name": {
  10. "type": "string"
  11. },
  12. "age": {
  13. "type": "number"
  14. }
  15.  
  16. },
  17. "required": ["name","age"]
  18. }
  19. }
  20.  
  21. }

Rest of the things are good to go. I hope issues will be resolved after making above changes.

Thanks & Regards

Parit Mittal

 

Sorry to gravedig but this issue has not been solved for me. When I have a data element that gets "geolocation" for example, it will work when I am using the default contexthub schema option, but it will break (return an empty string) if I use the custom contexthub schema option, even if I put "ContextHub" in the data layer root field. Can you try reproducing this?

Here is an interesting exercise

-Add the contexthub tool, select custom schema and put in "ContextHub" as the data layer root

-Create a data element that gets "geolocation" for example

-In the JS console, try doing _satellite.getVar for your data element. You should see an empty string

-Next type "ContextHub.geolocation = 1;", and do _satellite.getVar again

-You will see "1" being returned. It looks like When the custom schema option is selected, ContextHub is treated like a regular javascript object, which is not how contexthub stores data.