Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
BedrockMission!

Learn more

View all

Sign in to view all badges

SOLVED

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

StewSchilling
Community Advisor
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
StewSchilling
Correct answer by
Community Advisor
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
StewSchilling
Correct answer by
Community Advisor
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