Hi again. We still have a problem getting anythin...
# ask-questions
i
Hi again. We still have a problem getting anything from the tracking callback function in the launched AB test. We have installed growthbook via npm to our website according to instructions but failed to get any results despite that we have spotted changes we made through the visual editor. Everything is working fine while using isOn(), but this requires manual installation for every test, and we want to get rid of unnecessary load to our coders and launch most tests ourselves. In debugger, we have no problems there, but the callback still returns nothing. How can we get results from the running tests via callback? Is there any method we can use to force it to launch? Here is our code of tracking callback part:
Copy code
trackingCallback: (experiment, result) => {
    // TODO: Use your real analytics tracking system
    console.log("Viewed Experiment", {
      experimentId: experiment.key,
      variationId: result.key
    });
  }
});
h
Hi again, You shouldn't need to use isOn() for a visual editor experiment. Are you seeing the experiment register when using the GrowthBook dev tools (Chrome plugin)? Or have you tried putting your SDK into debug mode and seeing if it's evaluating or failing for the visual experiment: Set
enableDevMode: true
in the SDK constructor and set
window._growthbook.debug = true
.
i
@happy-autumn-40938 Hi. Yes, we know. Basically, gb is working and showing different versions, but we have a problem specifically with tracking callback. Yes, we see the experiment in debug mode, and no issues are shown. Yes, we tried to enable debug more with
enableDevMode: true
in the SDK constructor and set
window._growthbook.debug = true
To overcome this problem we tried to push data to the data layer with a visual editor (but this is definitely not how it should be)
Copy code
"js":"window.dataLayer = window.dataLayer || [];\n dataLayer.push(\n                    { \n                      event: 'experiment_viewed', \n                      eventCategory: 'experiment',\n                      experiment_id: 'black CTA',\n                      variation_id:  'show'\n                    }\n                )"
Please, help us to understand: 1. Why callback function can fail to launch? 2. When it should be launched (what trigger initiates it) 3. How can we force it to launch? If necessary I can send all the information you need to check it from your side
h
To better understand, does the actual DOM mutation for the visual experiment trigger? And you're just not getting the tracking callback? When things are working correctly, the tracking callback should be tightly coupled with your visual experiment applying DOM changes. You should never need to manually trigger your event tracking (dataLayer.push). If you'd like to share a URL with me (private message) I can take a quick look and see if there's anything obviously wrong.
i
"does the actual DOM mutation for the visual experiment trigger?" Yes "And you're just not getting the tracking callback?" yep, that`s right - we cant trigger this specific part "If you'd like to share a URL with me" done