Implement Server-Side Forwarding

This section lists and describes the required AppMeasurement.js and other service changes that let you migrate to server-side forwarding. Work closely with your Audience Manager and Analytics consultants during the migration process.

Important:
  • Read the requirements before you begin.
  • Configure and test this code in a development environment before implementing it in production.
  • This procedure is for customers who already use Analytics and Audience Manager and may or may not be enabled for Profiles & Audiences.

Get Provisioned for Profiles and Audiences

You must be provisioned for Profiles & Audiences to implement server-side forwarding. This service uses the Audience Management Module to send data to Audience Manager. To get started, work closely with your Analytics and Audience Manager consultants and complete the Experience Cloud provisioning form. The link takes you to a page that contains important provisioning and implementation information. Review that information carefully before submitting the form.

Important: List the tracking servers you want to use for server-side forwarding in the implementation form.

Download the AppMeasurement Code Libraries

Server-side forwarding requires the AppMeasurement_Module_AudienceManagement.js file. To download this code library:

  1. In Analytics, go to Admin > Code Manager.
  2. In Code Manager, click JavaScript (New). This downloads a .zip file that contains the required code libraries.
  3. Decompress the code file and save the AppMeasurement_Module_AudienceManagement.js file.

Add Audience Management Code to AppMeasurement

In this step, you'll add a line of loader code and the AppMeasurement_Module_AudienceManagement.js code to the AppMeasurement.js file. To edit the AppMeasurement file:

  1. Open the AppMeasurement.js file in your preferred code editor.
  2. Add this loader code, s.loadModule("AudienceManagement"); to the AppMeasurement file. Place this code above the warning text, DO NOT ALTER ANYTHING BELOW THIS LINE!
  3. Copy and paste the code from the AppMeasurement_Module_AudienceManagement.js file below the s.loadModule call. Again, make sure to put this code above the warning text, DO NOT ALTER ANYTHING BELOW THIS LINE!
  4. Save your changes.

Your edited AppMeasurement file should look similar to the sample code below. The Audience Management code has been shortened for brevity.

//Load the Audience Management module
s.loadModule("AudienceManagement");

//AppMeasurement_Module_AudienceManagement code has been shortened in this example because it's really long
function AppMeasurement_Module_AudienceManagement(d){var a=this;a.s=d;var b=window;b.s_c_in||(b.s_c_il=[],b.s_c_in=0);a._il=b.s_c_il;a._in=b.s_c_in;a._il[a._in]=a;b.s_c_in++;a._c="s_m";a.setup=function(c){b.DIL&&c&&(c.disableDefaultRequest=!0,c.disableScriptAttachment=!0,a.instance=b.DIL.create(c),a.tools=b.DIL.tools)};a.isReady=function(){return a.instance?!0:!1};a.getEventCallConfigParams=function(){return a.instance&&a.instance.api&&a.instance.api.getEventCallConfigParams?a.instance.api.getEventCallConfigParams():
{}};a.passData=function(b){a.instance&&a.instance.api&&a.instance.api.passData&&a.instance.api.passData(b)}}
...

/*
============== DO NOT ALTER ANYTHING BELOW THIS LINE ! ==============
Version and copyright section
*/

//AppMeasurement code here
function AppMeasurement(){var a=this;a.version="1.6";
...

Replace DIL with the Audience Manager Module

In this step you can replace or comment-out DIL code in the AppMeasurement.js file. If you do not remove or comment out DIL code, Audience Manager will receive duplicated trait data (from the new AppMeasurement code and from DIL). To avoid double-counting, remove or comment out your DIL code. To edit the AppMeasurement file:

  1. Find the DIL code in your AppMeasurement.js file (it's usually in the doPlugins section).
  2. Comment out the DIL code and replace it with the Audience Management Module as shown in the example below.
  3. Save your changes.

Your edited AppMeasurement file should look similar to the sample code below. In the sample code, some values have been replaced with plan-text descriptions or placeholders.

function s_doPlugins(s) {
	
	/*User CRM ID - example of it getting set in eVar1*/
	s.eVar1="123456789";
	
//Comment out your DIL code	
	
	/*var vidObj = {
		
				partner: 'partner name here',
				uuidCookie: {
					name: 'aam_uuid',
					days: 30
				},
				visitorService: {
				namespace: 'Experience Cloud ID here'
				},
				declaredId : {
				   dpuuid : s.eVar1,
				   dpid : '12345'
				},
		}
		
		var vidDil = DIL.create(vidObj);
		/*var _scDilObj = s_gi(s.account);
		DIL.modules.siteCatalyst.init(_scDilObj, vidDil, {
			names: ['pageName', 'channel', 'campaign', 'products', 'events', 'pe', 'referrer', 'server', 'purchaseID', 'zip', 'state'],
			iteratedNames: [{
				name: 'eVar',
				maxIndex: 75
			}, {
				name: 'prop',
				maxIndex: 75
			}, {
				name: 'pev',
				maxIndex: 3
			}, {
				name: 'hier',
				maxIndex: 4
			}]
		});
		
		if(s.eVar1){
			vidDil.api.aamIdSync({
					dpid: '54321',
					dpuuid: s.eVar1,
					minutesToLive: 20160
			});
		}
*/

//Replace DIL with the Audience Manager Module
		
		s.AudienceManagement.setup({
			 "partner":"partner name here",
			 "containerNSID":0,
			 "uuidCookie": { //optional if you want to set the UUID in the first-party domain
				"name":"aam_uuid",
				"days": 30
			}
		});

}
s.doPlugins=s_doPlugins

Update ID Synchronization Code

This change is required if you're synchronizing IDs with Audience Manager. Skip this change if you do not sync IDs. This update replaces the Audience ManageraamIdSync function with the visitor.setCustomerIDs function, which is provided by the Experience Cloud ID service. To use this ID synchronization code:

  1. Find the Audience Manager ID sync code in your AppMeasurement.js file. It should look similar to this:
    vidDil.api.aamIdSync({
         dpid: '12345',
         dpuuid: '12345abcd',
         minutesToLive: 20160
    });
  2. Replace the Audience Manager ID sync code with the ID service sync function as shown below. In this new function, an integration code replaces the DPID. An integration code is an identifier you apply to an Audience Manager data source. See also, Customer IDs and Authentication States.
    Visitor.setCustomerIDs({
         "my_integration_code_here":{  //You must use an integration code instead of a DPID  
              "id": '12345abcd',
              "authState": Visitor.AuthState.AUTHENTICATED

Test, Verify, and Deploy

Depending on what version of App Measurement code you’re using, this migration makes significant changes to the way you work with Analytics and Audience Manager. As a result, you should test and troubleshoot this code thoroughly before deploying it in a live, production environment. Work closely with your Adobe consultant during this phase and see the following documentation: