emarsys

package
v0.14.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 28, 2025 License: MIT Imports: 18 Imported by: 0

README

Emarsys Web Extend

The emarsys server side web extend provider makes use of the Web Extend Command.

Concept

Using Tag Manger, it's not really possible to send only one go call, so what we do instead, is sending multiple calls, ensuring to provide the same sessionId, visitorId & pageViewId.

So instead of doing e.g. this:

// The usual commands to identify visitors and report cart contents.
ScarabQueue.push(['cart', [
    {item: 'item_1', price: 19.9, quantity: 1},
    {item: 'item_2', price: 29.7, quantity: 3}
]]);
// Passing on item ID to report product view. Item ID should match the value listed in the Product Catalog
ScarabQueue.push(['view', 'item_3']);
// Firing the ScarabQueue. Should be the last call on the page, called only once.
ScarabQueue.push(['go']);

We are doing this on the server side:

// The usual commands to identify visitors and report cart contents.
ScarabQueue.push(['cart', [
    {item: 'item_1', price: 19.9, quantity: 1},
    {item: 'item_2', price: 29.7, quantity: 3}
]]);
// Firing the ScarabQueue. Should be the last call on the page, called only once.
ScarabQueue.push(['go']);

// Passing on item ID to report product view. Item ID should match the value listed in the Product Catalog
ScarabQueue.push(['view', 'item_3']);
// Firing the ScarabQueue. Should be the last call on the page, called only once.
ScarabQueue.push(['go']);

Initialization

Since we need to trigger multiple commands, we need to ensure we're always sending the same sessionId, visitorId & pageViewId for all calls. The initialization sets the emarsys.page_view_id variable into the dataLayer to be sent with each following request.

sequenceDiagram
  participant Data Layer
  participant Web Container
  participant Server Container
  participant Emarsys
  Web Container->>+Server Container: initialization (/gtag/js/emarsys)
  Server Container->>Emarsys: pageViewId (sesssionId, visitorId)
  Server Container->>-Web Container: Cookies (emarsys_cdv, emarsys_s)
  Web Container->>Data Layer: emarsys.page_view_id

Commands

Cart

NOTE: The default page_view event does not contain the items so we need to enrich them in the collect service.

sequenceDiagram
  participant Web Container
  participant Collect
  participant Server Container
  participant Emarsys

  Web Container->>Collect: page_view
  Collect->>+Server Container: enrich: items
  Server Container->>Emarsys: cart<br/>Cookies (s, cdv, xp, fc)
  Server Container->>-Web Container: Cookies (s, cdv, xp, fc)

Standard implementation

// The usual commands to identify visitors and report cart contents.
ScarabQueue.push(['cart', [
    {item: 'item_1', price: 19.9, quantity: 1},
    {item: 'item_2', price: 29.7, quantity: 3}
]]);
// Firing the ScarabQueue. Should be the last call on the page, called only once.
ScarabQueue.push(['go']);
View
sequenceDiagram
  participant Web Container
  participant Server Container
  participant Emarsys

  Web Container->>+Server Container: view_item
  Server Container->>Emarsys: view<br/>Cookies (s, cdv, xp, fc)
  Server Container->>-Web Container: Cookies (s, cdv, xp, fc)

Standard implementation

// Passing on item ID to report product view. Item ID should match the value listed in the Product Catalog
ScarabQueue.push(['view', 'item_3']);
// Firing the ScarabQueue. Should be the last call on the page, called only once.
ScarabQueue.push(['go']);
Category
sequenceDiagram
  participant Web Container
  participant Server Container
  participant Emarsys

  Web Container->>+Server Container: view_item_list
  Server Container->>Emarsys: category<br/>Cookies (s, cdv, xp, fc)
  Server Container->>-Web Container: Cookies (s, cdv, xp, fc)

Standard implementation

// Passing on the category path being visited. Must match the 'category' values listed in the Product Catalog
ScarabQueue.push(['category', 'Bikes > Road Bikes']);
// Firing the ScarabQueue. Should be the last call on the page, called only once.
ScarabQueue.push(['go']);
Purchase
sequenceDiagram
  participant Web Container
  participant Server Container
  participant Emarsys

  Web Container->>+Server Container: purchase
  Server Container->>Emarsys: category<br/>Cookies (s, cdv, xp, fc)
  Server Container->>-Web Container: Cookies (s, cdv, xp, fc)

Standard implementation

// Passing on order details. The price values passed on here serve as the basis of our revenue and revenue contribution reports.
ScarabQueue.push(['purchase', {
    orderId: '231213',
    items: [
      {item: 'item_1', price: 19.9, quantity: 1},
      {item: 'item_2', price: 29.7, quantity: 3}
    ]
}]);
// Firing the ScarabQueue. Should be the last call on the page, called only once.
ScarabQueue.push(['go']);

References

Documentation

Index

Constants

View Source
const (
	Tag                                          = "emarsys"
	Name                                         = "Emarsys"
	NameMerchantIDConstant                       = "Emarsys Merchant ID"
	NameWebEmarsysInitalizationTag               = "Emarsys Initialization"
	NameWebEmarsysInitalizationTagTemplate       = "Emarsys Initialization"
	NameServerEmarsysClient                      = "Emarsys Initialization"
	NameServerEmarsysWebExtendTagTemplate        = "Emarsys Web Extend"
	NameServerEmarsysInitalizationClientTemplate = "Emarsys Initialization"
)

Variables

This section is empty.

Functions

func Server

func Server(l *slog.Logger, tm *tagmanager.TagManager, cfg config.Emarsys) error

func Web

Types

This section is empty.

Directories

Path Synopsis
server
tag
web
tag

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL