My Adobe Launch Cheatsheet

谢谢原作者Jim Gordon写了第一个版本,我根据自己的经验在他的版本上加了些内容,希望对大家更有帮助。

 

Basic %% Syntax in Adobe Launch UI

AdobeLaunchBasics

Example

“%this…%” uses the element that you have selected.  In the following example, “this” is the <a> element: Hello

<a id="someLink" title="someTitle" href="https://jimalytics.com" "my-custom-attribute='something'>
<p class="hi">Hello</p>

%this.title% = someTitle
%this.id% = someLink
%this.innerHTML% = <p>Hello</p>
%this.href% = https://jimalytics.com
%this.@text% = Hello
%this.getAttribute('my-custom-attribute')% = something

“%target…%” uses the child of the element that you have selected. In the current example, “target” is the <p> element:

%target.innerHTML% = Hello
%target.className% = hi
%target.@text% = Hello

You can use anything that is available in the DOM for that element, which may include className, alt, href, id, innerHTML, title, src, etc.

%this.href%
%this.className%
%this.alt%
%this.src%
%this.@text%
%this.@cleanText%
%this.getAttribute(name)%
%this.id%
%this.title%

The %% syntax can also be used to get the document properties hostname and request URI (document.location.pathname):

%URI% = /my-adobe-launch-cheatsheet/

%hostname% = chinaweboptimization.com

%URI%
%hostname%
%protocol%

 

Data Elements

Using Data Element in UI

Get Data Element in code

_satellite.getVar('data element name');

Set Data Element:

_satellite.setVar('element name', value);

Set multiple Data Element values at once:

_satellite.setVar({ 'product': 'Circuit Pro', 'category': 'hobby' });

Example:

<a id="someLink" title="link" href="/"><p class="hi">Hello</p></a>

_satellite.setVar('link ID', $(this).attr("id")); // sets the variable

Important Notes

  • setVar saves the data element on a page level scope
  • When you manually override a data element that exists and has a scope, it retains the scope of the element.

Cookies

Set a browser cookie

_satellite.cookie.set('my cookie name', 'my cookie value') //expires in a session
_satellite.cookie.set('my cookie name', 'my cookie value' {expiration: days}) //expires in a day
_satellite.cookie.set('my cookie name', 'my cookie value', {expires: 730}) //expires in 2 years

Read a browser cookie

_satellite.cookie.get('my cookie name')

Remove a browser cookie

_satellite.cookie.remove('my cookie name')

Cross-browser console logging

_satellite.logger.log('whatever you want to display as regular logs')
_satellite.logger.info('whatever you want to display as info')
_satellite.logger.warn('whatever you want to display in yellow')
_satellite.logger.error('whatever you want to display in red')

Each type of log corresponds to the filters in browser console

adobe launch logger

Logs are only visible when you have installed the Adobe Launch Switch, and turned debug mode on:

You can also manually turn on debug mode with this command:

_satellite.setDebug(true);

Direct Call Rule

Creating Direct Call Rule

creating direct call rule

Calling Direct Call Rule without details example:

_satellite.track("login success")

Calling Direct Call Rule with additional details example:

_satellite.track(“login success”,{
username:“jd12345”,
status:“vip”,
age:“54”
})

You can pass details within details:

_satellite.track("login success",{
user-info:{
username:"jd12345",
status:"vip",
age:"54"
},
login-date:"20191120"})

Retrieve additional details when Direct Call Rule is triggered in code:

s.eVar1 = event.detail.username
s.eVar2 = event.detail.status
s.eVar1 = event.detail.age

The equivalent in UI:

Get Adobe Visitor ID Service object

_satellite.getVisitorId()

Get MarketingCloud ID/Experience Cloud ID

_satellite.getVisitorId().getMarketingCloudVisitorID(‘<Your Adobe Org ID>’)

For more information, visit https://docs.adobe.com/content/help/en/id-service/using/home.html

Get current build info

_satellite.buildInfo
  • turbineVersion
The Turbine version used inside the current library.
  • turbineBuildDate
The ISO 8601 date when the version of Turbine used inside the container was built.
  • buildDate
The ISO 8601 date when the current library was built.
  • environment
The environment for which this library was built. The possible values are:
  • development
  • staging
  • production

Content Security Policy (CSP)

https://docs.adobe.com/content/help/en/launch/using/reference/client-side-info/content-security-policy-csp.html