Link Decoration

Currently, link decoration is a feature which must be configured by Fanplayr's Customer Success team. Reach out to your manager if you would like to use this feature.
Fanplayr can be integrated into multiple domains belonging to the same account. Normally each domain would correspond to a separate campaign and its own distinct browsing session for that campaign. However, there are scenarios where it may be better to use one campaign and browsing session across multiple domains.
Link Decoration is a feature which allows a Fanplayr session to continue across multiple domains. It works by augmenting links on the page so that they include the Fanplayr session identifier to ensure that this information is carried forward to the following domain.
Multiple techniques can be employed to decorate links on pages. These techniques can be applied extensively to all links on the page, or applied narrowly to target only specific links. Each technique has advantages and tradeoffs, and their use will depend on the needs of the website and how it is designed:
  • Rewriting regular links (<a href="..."> tags).
  • Rewriting form action URLs.
  • Monitoring for clicks on the page, then if a link was clicked, rewriting it before navigation.
  • Augmenting browser APIs such as window.open().
Link decoration can be enabled by configuring the following JSON structure as the linkAugmentConfig account preference:
[
{
// Config only works on hostnames that match RegExpthis pattern.
"domainPattern": "store\\.com",
// Will only decorate links matching this RegExp pattern.
"linkPattern": "other-store\\.com",
// Wrap `window.open()` and decorate the first argument.
"windowOpen": true,
// Decorate all anchors with hrefs matching the link pattern.
"rewriteHrefs": false,
// Decorate all forms with actions matching the link pattern.
"rewriteForms": false,
// Listen for all clicks on page and decorate the closest link.
"monitorClicks": true,
// Delay initialization by X milliseconds.
"delay": 1000
}
]

domainPattern

  • Type: string
  • Required: Yes
If current url in the browser matches this pattern the rules in the config are applied to the current page view. Only the first config that is matched is used.

linkPattern

  • Type: string (regular expression)
  • Required: Yes
Only links that match this pattern are decorated (modified) to append parameters to help continue the session after navigation.

delay

  • Type: integer
  • Default: 0
The number of milliseconds to wait before executing the link decoration config methods.

windowOpen

  • Type: boolean
  • Default: false
Decoration method Wraps the window.open() method to watch for calls to this browser API. Any urls that match linkPattern are decorated before passing back to the native browser method.

rewriteHrefs

  • Type: boolean
  • Default: false
Decoration method Searches for all <a> tags on the page and decorates them in-place if their href attribute that matches linkPattern.

rewriteForms

  • Type: boolean
  • Default: false
Decoration method Searches for all <form> tags on the page and decorates those with an action attribute that matches linkPattern.

monitorClicks

  • Type: boolean
  • Default: false
Decoration method Attaches click and touchstart event listeners to the document using the capture phase. When the user interacts with any part of the document, the closest <a> tag is found and decorated if its href attribute matches linkPattern.
Last modified 2yr ago