Expand my Community achievements bar.

SOLVED

Optimizely - Adobe Custom Integration

Avatar

Level 3

We're trying to paste the Optimizely custom adobe integration script on DTM but I'm being advised that the script won't work because our DTM implementation does not use the s_code approach.  Below is the documentation from Optimizely:

Add this JavaScript code to your Adobe Analytics s_code.js file in the plug-ins section (or directly on your page after the s_code.js loads, but before the Adobe Analytics s.t(); call is made):

if (window.optimizely && typeof window.optimizely.get === 'function' && window.optimizely.get("custom/adobeIntegrator")) { window.optimizely.get("custom/adobeIntegrator").assignCampaigns(s); } 

The timing of this code is very important. The s object must be defined so the integration can write to it, but s.t();must not be called yet. Note that the s variable is being passed as a parameter to .assignCampaigns(). It's possible your organization uses a custom s variable so be sure to pass in the appropriate object.

Any thoughts on how we might be able to fix this issue?

-Robert

1 Accepted Solution

Avatar

Correct answer by
Level 9

There are many ways you can implement Adobe Analytics within DTM, and a good answer will vary / be applicable depending on which path you took.  If you implemented Adobe Analytics as a Tool, have everything set to Automatic, have done no customizations, etc. then by default DTM does not instantiate the Adobe Analytics s object in the global (window) namespace, but you can still reference it within many of the custom code boxes throughout DTM.  So (again, assuming you "out-of-the-boxed Adobe Analytics), below are a few solutions that should work for you.

If the below solutions do not work for you, then you have a more custom AA implementation, so you will need to provide details for how exactly Adobe Analytics is setup within your DTM property.

Solution #1 - Add doPLugins (and the optimizely code) to your AA tool code config

In your Adobe Analytics Tool config, Scroll down to the Customize Page Code section, and click on the Open Editor button.

In the code box, add the following:

s.usePlugins = true;

s.doPlugins = function (s) {

  try {

    if (window.optimizely && typeof window.optimizely.get === 'function' && window.optimizely.get("custom/adobeIntegrator")) { window.optimizely.get("custom/adobeIntegrator").assignCampaigns(s); }

  } catch(e) {window.console&&console.error(e);}

}

Solution #2 - Add the Optimizely code to a Page Load Rule

Go to Rules > Page Load Rules, and click the blue Create New Rule button.

Name the rule something like "Optimizely Config" or whatever your naming convention is.

Scroll down and expand the Adobe Analytics section, and under Custom Page Code, click the Open Page Code button.

In the code box, add your Optimizely code:

try {

  if (window.optimizely && typeof window.optimizely.get === 'function' && window.optimizely.get("custom/adobeIntegrator")) { window.optimizely.get("custom/adobeIntegrator").assignCampaigns(s); }

} catch(e) { window.console&&console.error(e);}

View solution in original post

2 Replies

Avatar

Correct answer by
Level 9

There are many ways you can implement Adobe Analytics within DTM, and a good answer will vary / be applicable depending on which path you took.  If you implemented Adobe Analytics as a Tool, have everything set to Automatic, have done no customizations, etc. then by default DTM does not instantiate the Adobe Analytics s object in the global (window) namespace, but you can still reference it within many of the custom code boxes throughout DTM.  So (again, assuming you "out-of-the-boxed Adobe Analytics), below are a few solutions that should work for you.

If the below solutions do not work for you, then you have a more custom AA implementation, so you will need to provide details for how exactly Adobe Analytics is setup within your DTM property.

Solution #1 - Add doPLugins (and the optimizely code) to your AA tool code config

In your Adobe Analytics Tool config, Scroll down to the Customize Page Code section, and click on the Open Editor button.

In the code box, add the following:

s.usePlugins = true;

s.doPlugins = function (s) {

  try {

    if (window.optimizely && typeof window.optimizely.get === 'function' && window.optimizely.get("custom/adobeIntegrator")) { window.optimizely.get("custom/adobeIntegrator").assignCampaigns(s); }

  } catch(e) {window.console&&console.error(e);}

}

Solution #2 - Add the Optimizely code to a Page Load Rule

Go to Rules > Page Load Rules, and click the blue Create New Rule button.

Name the rule something like "Optimizely Config" or whatever your naming convention is.

Scroll down and expand the Adobe Analytics section, and under Custom Page Code, click the Open Page Code button.

In the code box, add your Optimizely code:

try {

  if (window.optimizely && typeof window.optimizely.get === 'function' && window.optimizely.get("custom/adobeIntegrator")) { window.optimizely.get("custom/adobeIntegrator").assignCampaigns(s); }

} catch(e) { window.console&&console.error(e);}

Avatar

Level 3

Thanks for your feedback. I'll give this a try and see if your approach

works.

-Robert

On Wed, Nov 15, 2017 at 10:54 PM, joshd7227840 <forums_noreply@adobe.com>