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

Avatar

Avatar

StewSchilling

MVP

Avatar

StewSchilling

MVP

StewSchilling
MVP

26-02-2018

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

Accepted Solutions (1)

Accepted Solutions (1)

Avatar

Avatar

StewSchilling

MVP

Avatar

StewSchilling

MVP

StewSchilling
MVP

27-02-2018

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);

});

Answers (0)