Expand my Community achievements bar.

Join us on September 25th for a must-attend webinar featuring Adobe Experience Maker winner Anish Raul. Discover how leading enterprises are adopting AI into their workflows securely, responsibly, and at scale.

Mark Solution

This conversation has been locked due to inactivity. Please create a new post.

SOLVED

How to get the "s" object into the scope of an extension using turbine.getSharedModule

Avatar

Community Advisor

I want to build a Launch extension that can manipulate values on the Adobe Analytics tracker object ("s" by default).

I see in the Feb 8 release notes that the updated Adobe Analytics extension (v1.1) provides access to the tracker object via shared modules.

I see here that the function to call is turbine.getSharedModule

I see via inspection of the api calls on the extensions page that the AA extension name is "adobe-analytics".

So, I'm left with a couple questions:

1) How do I get the updated Adobe Analytics extension (v1.1)?   I only see 1.0.0 in the extension catalog and I don't see any way to update.

2) What is the string to use for the sharedModuleName parament in turbine.getSharedModule? 

My best guess is below:

var sObject = turbine.getSharedModule('adobe-analytics', 'tracker');

Thanks in advance!

-Stew

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

Or maybe this? (updated on 12/7/2018)

//Get the function from the adobe-analytics extension

var getTrackerFn = turbine.getSharedModule("adobe-analytics", "get-tracker");

//Call the function, which will return a promise

getTrackerFn().then(function(tracker) {

     // if resolved

     //do stuff with the tracker object (tracker is what we could traditionally call "s")

     tracker.eVar1 = "Josh";

     tracker.eVar2 = "Stew";

}, function(err) {

     //if rejected

     turbine.logger.error("Strange things are afoot at the Circle-K", err);

});

View solution in original post

1 Reply

Avatar

Correct answer by
Community Advisor

Or maybe this? (updated on 12/7/2018)

//Get the function from the adobe-analytics extension

var getTrackerFn = turbine.getSharedModule("adobe-analytics", "get-tracker");

//Call the function, which will return a promise

getTrackerFn().then(function(tracker) {

     // if resolved

     //do stuff with the tracker object (tracker is what we could traditionally call "s")

     tracker.eVar1 = "Josh";

     tracker.eVar2 = "Stew";

}, function(err) {

     //if rejected

     turbine.logger.error("Strange things are afoot at the Circle-K", err);

});