Expand my Community achievements bar.

SOLVED

Dynamically swap launch embed codes for a website

Avatar

Level 1

thebenrobb​: Is it possible to dynamically swap launch embed codes for a website built using AEM and ContextHub.

Details as follows:

Example:

> www.abc.co.uk

> www.abc.ie

Details:

> Both share same ContextHub.

> They have different web properties setup within Adobe Launch for each location i.e. 1 for UK and 1 for Ireland with 3 environments in each (dev/staging/prod)

Requirements:

> To dynamically swap the Launch embed codes in each of the environments depending on the location i.e. UK or IE in order to ensure that only the Ireland Launch Embed code load on Ireland website environments while only UK Launch Embed Code loads on the UK website. Thus, allowing for higher degree of control over different web properties.

1 Accepted Solution

Avatar

Correct answer by
Employee

It sounds like you just need to have your CMS templates that serve the UK pages use the UK property embed code and the CMS templates that serve the Ireland pages use the Ireland property embed code.

Then whatever is in the UK property is on the UK pages and whatever is in the Ireland property is on the Ireland site.  No need for dynamic swapping at run-time, just get the right embed codes in the right templates.

You could do it dynamically with JavaScript, but Launch couldn't manage it for you. The embed code references a built library from one (and only one property), so any logic you needed to determine which embed code to load has to run before you actually load the library.

View solution in original post

3 Replies

Avatar

Employee

I'm not sure I understand what you're trying to do.  You want to swap them within your own browser for testing?  Or something more broad than that?

Avatar

Level 1

Hey thebenrobb,

Thanks for reaching out!

As detailed in my query we have two different Adobe Launch Properties with different embed codes setup i.e. 1 for www.abc.co.uk and 1 for www.abc.ie.

Observation: Both of these websites share the same contexthub.

Scenarios:

#1: To only have the UK embed code for Adobe Launch load when a user visits abc.co.uk so that only the codes/rules/date elements existing within Adobe Launch UK Property are present on the UK website.

#2: To only have the Ireland embed code for Adobe Launch load when a user visits abc.ie so that only the codes/rules/date elements existing within Adobe Launch Ireland Property are present on Ireland website.

#3: If User visits UK website and switches to Ireland website then upon page load the launch embed code loaded on that page should be for Ireland website and not the UK Website.

Hence, the requirement is to have these Launch Embed codes dynamically swapped based on the domain the user has landed on in order to keep the Ireland rules from firing on UK and vice-versa.

PS: I want to avoid putting in the exclusion condition of "Not UK" in my Ireland rules and vice-versa. Hence, want to investigate if there is a way to dynamically swap Launch Embed codes based on domains i.e. UK or IE.

Thanks,

Isharpal Singh

Avatar

Correct answer by
Employee

It sounds like you just need to have your CMS templates that serve the UK pages use the UK property embed code and the CMS templates that serve the Ireland pages use the Ireland property embed code.

Then whatever is in the UK property is on the UK pages and whatever is in the Ireland property is on the Ireland site.  No need for dynamic swapping at run-time, just get the right embed codes in the right templates.

You could do it dynamically with JavaScript, but Launch couldn't manage it for you. The embed code references a built library from one (and only one property), so any logic you needed to determine which embed code to load has to run before you actually load the library.