Unlike WebTag Legacy, your Webtag ID will not expire in WebTag 2.0. Therefore, you do not need to retrieve new tokens in WebTag 2.0.
On the main HTML domain page, insert the webtag script within the <header> tags. This script synchronizes the calling mechanism with the SDK Library to request access to CDP Tracker, triggering the subdomain page based on the specified event.
<script>
var $A1Config = {
webtagId: "your-webtag-id", // Paste your webtagId value provided by Acquia.
tenantId: 999, // Example set the static tenant ID.
host: "//url.endpoint.com" // Set the service endpoint URL accordding to your hosted environment and cloud region.
};
</script>
<script src="https://scripts.agilone.com/latest/acquia-cdp-webtag.js"></script>
Parameter
Description
webtagId
webtagId is the Webtag ID provided by your Acquia representative.
tenantId
1111, 2222, 3333 are numerical path identifiers that correlate with the tenant ID for account access.
host
//url.endpoint.com acts as the service endpoint, allowing users to push data to the appropriate environment and cloud services.
src
https://scripts.agilone.com/latest/acquia-cdp-webtag.js invokes the new CDP SDK script.
domain (optional)
.acme.com serves as the default main domain for setting up CDP tracking mechanism as a first-party cookie. If you omit it, it might default to a sub-domain cookie, potentially being flagged and blocked as a third-party cookie by Google policies.
domain: ".acme.com", // Set the static main domain(no subdomain).
The code to capture the unique ID and store it in a session must be placed on each subpage of your main website page where you want to track visitor interactions. This can be part of your website's global header or another common include that runs before the page content is fully rendered.
Capture the Unique ID:
Javascript code snippet visitor identify as logged in to the site:
var currentVisitor = $A1.Customer ( {
SourceCustomerNumber: "6952E515-B67C-CB1B-3B21-GRG9GBN0LN8DF", // Customer Unique ID can be either an email address or a numerical value.
UUID: "6952E515-B67C-CB1B-3B21-GRG9GBN0LN8DF", // Duplication of Customer Unique ID can be either an email address or a numerical value.
Email: "[email protected]", // Customer email address value.
// Add Other data points in this object
} );
$A1.event = {
SourceCustomerNumber: "6952E515-B67C-CB1B-3B21-GRG9GBN0LN8DF", // Customer Unique ID can be either an email address or a numerical value.
Email: "[email protected]", // Customer email address value.
// Add Other data points in this object
};
Javascript code snippet visitor anonymous as logged out from the site:
var currentanonymousVisitor = $A1.Customer ( {
SourceCustomerNumber: "6952E515-B67C-CB1B-3B21-GRG9GBN0LN8DF", // Customer Unique ID can be either an email address or a numerical value.
UUID: "6952E515-B67C-CB1B-3B21-GRG9GBN0LN8DF", // Duplication of Customer Unique ID can be either an email address or a numerical value.
} );
$A1.event = {
SourceCustomerNumber: "6952E515-B67C-CB1B-3B21-GRG9GBN0LN8DF", // Customer Unique ID can be either an email address or a numerical value.
Email: "[email protected]", // Customer email address value.
// Add Other data points in this object
};
Store the Unique ID in your website's session.
This usually involves setting a session cookie with the unique ID value, ensuring it remains throughout the visitor's browser session.
Send the Unique ID to CDP using the CDP WebTag library or the DW Tracker API.
Ensure that you include the unique identifier and any relevant visitor information in the payload of an HTTP call to CDP. The data structure within the payload depends on whether the visitor is logged in to your website.
CDP maps the received values from the Customer feed - External Source to SourceCustomerNumber and UUID. This results in the following customer summary record:
The payload of each event contains required and optional attributes that vary by event type. If an attribute is not applicable or the data is not available on certain pages, do not include those attributes.
Review the website or mobile app to implement relevant events.
For example, use a cartUpdated event for Quick Add to Cart clicks, a productBrowsed event for Quick View clicks, and a login event when a form is filled out with an email address. The CDP implementation team can assist with tracking these events on your website or mobile app.
Identify visitors for every event. Whenever possible, include a customer entity with each event in every call.
Attributes and values sent to the SDK are case-sensitive. For example, when identifying a customer's email, send the details to the CDP, and ensure that the "Email" payload object starts with a capital "E."
var currentVisitor = $A1.Customer({
SourceCustomerNumber: "123",
Email: “[email protected]” // Key ”Email” with a capital “E”
});
var currentVisitor = $A1.Customer({
SourceCustomerNumber: "123",
email: “[email protected]” // Key ”email” with a lower case “e”
});
Do not initialize an object if you do not intend to send it.
For instance, if transactions do not match the attributes and you do not plan to send them through the WebTag, avoid initializing a `$A1.Transaction({})` object. For details on multiple source systems, refer to the warnings in CDP entities. CDP adds `SourceTransactionNumber` to the event object using targets. CDP does not add anything to the Transaction entity but adds information to the Event and Customer entities with `SourceTransactionNumber` included in the Event entity.
This indicates that customer "123" has added product "ABC123" to their cart. If customer "123" adds another product "DEF456" to their cart, execute the following additional JavaScript:
var productDEF456 = $A1.Target({SourceProductNumber: "DEF456"});
myEvent.add("targets", productDEF456).send();
This indicates two cart updates. The customer "123" has added products "ABC123" and "DEF456." If customer "123" adds another product "GHI789" to the cart and removes "DEF456," execute the following additional JavaScript:
Any change to the cart or its contents triggers a cartUpdated event, which includes a set of targets that reflect the list of current products present in the cart. This is because CDP does not track the cart's state and cannot infer its content from previous updates.
For this event, you must send the following data to CDP:
In the following example, CDP assumes that the visitor is already identified and can reuse the customer instance.
An event instance of type checkout includes a customer, a transaction, and a set of targets.
Optional:
A set of target entities representing the transaction items, with attributes set as SourceTransactionItemNumber, SourceProductNumber, and Type.
A transaction instance with SourceTransactionNumber and Total attributes set.
The following is an example of implementation using the model-oriented approach:
var item1 = $A1.Target({
SourceTransactionItemNumber: "WEB958-1",
Type: “Purchase”,
Subtype: “Pending”,
SourceProductNumber: "555",
quantity: 2,
saleRevenue: 321.13,
discount”: 0.00
}); //defining a transactionItem to be included in the checkout event
var item2 = $A1.Target({
SourceTransactionItemNumber: "WEB958-2",
Type: “Purchase”,
Subtype: “Pending”,
SourceProductNumber: "667",
quantity: 1,
saleRevenue: 23.87,
discount: 0.00
}); //defining another transactionItem to be included in the checkout event
var transactionWEB958 = $A1.Transaction({
SourceTransactionNumber: "WEB958",
SourceOrganizationNumber: "12",
Type: “Purchase”
}); //defining the transaction
$A1.Event({
type: “checkout”,
customer: currentVisitor,
transaction: transactionWEB958,
targets: [item1, item2]
})// send the event
.send();
This indicates that customer "123" conducted a transaction "WEB958" with a total revenue of $345. The transaction includes two items:
"WEB958-1" contains two products "555" with total revenue of $321.13
"WEB958-2" contains product "667" with total revenue of $23.87.
Note
You must send Transactions and TransactionItem entities only if the SourceTransactionNumber and SourceTransactionItemNumber values match those sent to the CDP in the standard Transaction feed and standard Transaction Item feed.
If the transactions come through the WebTag with different identifiers, it creates a new transaction in the CDP, resulting in duplicate transactions and double-counting of revenue, transaction counts, or other metrics.
If you send a checkout event without including transactions, you must provide a SourceTransactionNumber to avoid an API error from the CDP, as checkout events mandate transactions. To bypass this requirement, use this checkout snippet code. This informs the API to associate the event with a transaction by setting SourceTransactionNumber to an empty string, which does not link to any actual transaction.
CDP WebTag allows for the transmission of custom attributes on standard CDP entities or the creation of custom events based on your business needs.
CDP must be configured with these custom attributes before they can be included in the WebTag's event payload. These attributes can include information related to standard entities on your website, such as the payment method used by customers for transactions.
Important
If you are uncertain whether custom attributes are configured in CDP, consult your CDP team and do not implement these attributes in your WebTag installation, as this could cause API errors and block events from being sent to CDP.
Sending custom attributes on standard entities
You must send information to the WebTag only if it serves as the authentic source for that data. Data can be overwritten if it comes from multiple sources because CDP always takes the latest values regardless of the data source.
Events, Customer, Transaction, and Target entities
In the following example, consider that you are implementing a custom attribute called "paymentMethod" with the value "Visa" on a transaction entity.
All standard entities supported by the SDK models can include custom attributes.
The following is an example of implementation using the model-oriented approach:
<script>
// Define the transaction
var currentTransaction = $A1.Transaction({
SourceTransactionNumber: "WEBORDER-789",
SourceOrganizationNumber: "ORG098",
type: “Purchase”,
saleRevenue: 195.00,
discount: 20.00,
tax: 19.50,
paymentMethod: "Visa"
});
// Attach the transaction to the "checkout" event (assuming the customer and the transaction items have already been defined earlier)
var checkoutEvent = $A1.Event("checkout", {
customer: currentVisitor,
transaction: currentTransaction,
targets: [item1, item2],
...
});
</script>
Configuring WebTag 2.0 manually
This page provides instructions to configure WebTag 2.0 manually.
Use the following checklist to configure WebTag 2.0:
S.No.
Task
Description
1
Embed the Global WebTag 2.0 script within the <header> tags.
Unlike WebTag Legacy, your Webtag ID will not expire in WebTag 2.0. Therefore, you do not need to retrieve new tokens in WebTag 2.0.
On the main HTML domain page, insert the webtag script within the <header> tags. This script synchronizes the calling mechanism with the SDK Library to request access to CDP Tracker, triggering the subdomain page based on the specified event.
<script>
var $A1Config = {
webtagId: "your-webtag-id", // Paste your webtagId value provided by Acquia.
tenantId: 999, // Example set the static tenant ID.
host: "//url.endpoint.com" // Set the service endpoint URL accordding to your hosted environment and cloud region.
};
</script>
<script src="https://scripts.agilone.com/latest/acquia-cdp-webtag.js"></script>
Parameter
Description
webtagId
webtagId is the Webtag ID provided by your Acquia representative.
tenantId
1111, 2222, 3333 are numerical path identifiers that correlate with the tenant ID for account access.
host
//url.endpoint.com acts as the service endpoint, allowing users to push data to the appropriate environment and cloud services.
src
https://scripts.agilone.com/latest/acquia-cdp-webtag.js invokes the new CDP SDK script.
domain (optional)
.acme.com serves as the default main domain for setting up CDP tracking mechanism as a first-party cookie. If you omit it, it might default to a sub-domain cookie, potentially being flagged and blocked as a third-party cookie by Google policies.
domain: ".acme.com", // Set the static main domain(no subdomain).
The code to capture the unique ID and store it in a session must be placed on each subpage of your main website page where you want to track visitor interactions. This can be part of your website's global header or another common include that runs before the page content is fully rendered.
Capture the Unique ID:
Javascript code snippet visitor identify as logged in to the site:
var currentVisitor = $A1.Customer ( {
SourceCustomerNumber: "6952E515-B67C-CB1B-3B21-GRG9GBN0LN8DF", // Customer Unique ID can be either an email address or a numerical value.
UUID: "6952E515-B67C-CB1B-3B21-GRG9GBN0LN8DF", // Duplication of Customer Unique ID can be either an email address or a numerical value.
Email: "[email protected]", // Customer email address value.
// Add Other data points in this object
} );
$A1.event = {
SourceCustomerNumber: "6952E515-B67C-CB1B-3B21-GRG9GBN0LN8DF", // Customer Unique ID can be either an email address or a numerical value.
Email: "[email protected]", // Customer email address value.
// Add Other data points in this object
};
Javascript code snippet visitor anonymous as logged out from the site:
var currentanonymousVisitor = $A1.Customer ( {
SourceCustomerNumber: "6952E515-B67C-CB1B-3B21-GRG9GBN0LN8DF", // Customer Unique ID can be either an email address or a numerical value.
UUID: "6952E515-B67C-CB1B-3B21-GRG9GBN0LN8DF", // Duplication of Customer Unique ID can be either an email address or a numerical value.
} );
$A1.event = {
SourceCustomerNumber: "6952E515-B67C-CB1B-3B21-GRG9GBN0LN8DF", // Customer Unique ID can be either an email address or a numerical value.
Email: "[email protected]", // Customer email address value.
// Add Other data points in this object
};
Store the Unique ID in your website's session.
This usually involves setting a session cookie with the unique ID value, ensuring it remains throughout the visitor's browser session.
Send the Unique ID to CDP using the CDP WebTag library or the DW Tracker API.
Ensure that you include the unique identifier and any relevant visitor information in the payload of an HTTP call to CDP. The data structure within the payload depends on whether the visitor is logged in to your website.
CDP maps the received values from the Customer feed - External Source to SourceCustomerNumber and UUID. This results in the following customer summary record:
The payload of each event contains required and optional attributes that vary by event type. If an attribute is not applicable or the data is not available on certain pages, do not include those attributes.
Review the website or mobile app to implement relevant events.
For example, use a cartUpdated event for Quick Add to Cart clicks, a productBrowsed event for Quick View clicks, and a login event when a form is filled out with an email address. The CDP implementation team can assist with tracking these events on your website or mobile app.
Identify visitors for every event. Whenever possible, include a customer entity with each event in every call.
Attributes and values sent to the SDK are case-sensitive. For example, when identifying a customer's email, send the details to the CDP, and ensure that the "Email" payload object starts with a capital "E."
var currentVisitor = $A1.Customer({
SourceCustomerNumber: "123",
Email: “[email protected]” // Key ”Email” with a capital “E”
});
var currentVisitor = $A1.Customer({
SourceCustomerNumber: "123",
email: “[email protected]” // Key ”email” with a lower case “e”
});
Do not initialize an object if you do not intend to send it.
For instance, if transactions do not match the attributes and you do not plan to send them through the WebTag, avoid initializing a `$A1.Transaction({})` object. For details on multiple source systems, refer to the warnings in CDP entities. CDP adds `SourceTransactionNumber` to the event object using targets. CDP does not add anything to the Transaction entity but adds information to the Event and Customer entities with `SourceTransactionNumber` included in the Event entity.
This indicates that customer "123" has added product "ABC123" to their cart. If customer "123" adds another product "DEF456" to their cart, execute the following additional JavaScript:
var productDEF456 = $A1.Target({SourceProductNumber: "DEF456"});
myEvent.add("targets", productDEF456).send();
This indicates two cart updates. The customer "123" has added products "ABC123" and "DEF456." If customer "123" adds another product "GHI789" to the cart and removes "DEF456," execute the following additional JavaScript:
Any change to the cart or its contents triggers a cartUpdated event, which includes a set of targets that reflect the list of current products present in the cart. This is because CDP does not track the cart's state and cannot infer its content from previous updates.
For this event, you must send the following data to CDP:
In the following example, CDP assumes that the visitor is already identified and can reuse the customer instance.
An event instance of type checkout includes a customer, a transaction, and a set of targets.
Optional:
A set of target entities representing the transaction items, with attributes set as SourceTransactionItemNumber, SourceProductNumber, and Type.
A transaction instance with SourceTransactionNumber and Total attributes set.
The following is an example of implementation using the model-oriented approach:
var item1 = $A1.Target({
SourceTransactionItemNumber: "WEB958-1",
Type: “Purchase”,
Subtype: “Pending”,
SourceProductNumber: "555",
quantity: 2,
saleRevenue: 321.13,
discount”: 0.00
}); //defining a transactionItem to be included in the checkout event
var item2 = $A1.Target({
SourceTransactionItemNumber: "WEB958-2",
Type: “Purchase”,
Subtype: “Pending”,
SourceProductNumber: "667",
quantity: 1,
saleRevenue: 23.87,
discount: 0.00
}); //defining another transactionItem to be included in the checkout event
var transactionWEB958 = $A1.Transaction({
SourceTransactionNumber: "WEB958",
SourceOrganizationNumber: "12",
Type: “Purchase”
}); //defining the transaction
$A1.Event({
type: “checkout”,
customer: currentVisitor,
transaction: transactionWEB958,
targets: [item1, item2]
})// send the event
.send();
This indicates that customer "123" conducted a transaction "WEB958" with a total revenue of $345. The transaction includes two items:
"WEB958-1" contains two products "555" with total revenue of $321.13
"WEB958-2" contains product "667" with total revenue of $23.87.
Note
You must send Transactions and TransactionItem entities only if the SourceTransactionNumber and SourceTransactionItemNumber values match those sent to the CDP in the standard Transaction feed and standard Transaction Item feed.
If the transactions come through the WebTag with different identifiers, it creates a new transaction in the CDP, resulting in duplicate transactions and double-counting of revenue, transaction counts, or other metrics.
If you send a checkout event without including transactions, you must provide a SourceTransactionNumber to avoid an API error from the CDP, as checkout events mandate transactions. To bypass this requirement, use this checkout snippet code. This informs the API to associate the event with a transaction by setting SourceTransactionNumber to an empty string, which does not link to any actual transaction.
CDP WebTag allows for the transmission of custom attributes on standard CDP entities or the creation of custom events based on your business needs.
CDP must be configured with these custom attributes before they can be included in the WebTag's event payload. These attributes can include information related to standard entities on your website, such as the payment method used by customers for transactions.
Important
If you are uncertain whether custom attributes are configured in CDP, consult your CDP team and do not implement these attributes in your WebTag installation, as this could cause API errors and block events from being sent to CDP.
Sending custom attributes on standard entities
You must send information to the WebTag only if it serves as the authentic source for that data. Data can be overwritten if it comes from multiple sources because CDP always takes the latest values regardless of the data source.
Events, Customer, Transaction, and Target entities
In the following example, consider that you are implementing a custom attribute called "paymentMethod" with the value "Visa" on a transaction entity.
All standard entities supported by the SDK models can include custom attributes.
The following is an example of implementation using the model-oriented approach:
<script>
// Define the transaction
var currentTransaction = $A1.Transaction({
SourceTransactionNumber: "WEBORDER-789",
SourceOrganizationNumber: "ORG098",
type: “Purchase”,
saleRevenue: 195.00,
discount: 20.00,
tax: 19.50,
paymentMethod: "Visa"
});
// Attach the transaction to the "checkout" event (assuming the customer and the transaction items have already been defined earlier)
var checkoutEvent = $A1.Event("checkout", {
customer: currentVisitor,
transaction: currentTransaction,
targets: [item1, item2],
...
});
</script>
Besides the entities you send to the CDP, the SDK collects the following additional information with each request:
UserAgent - This is collected from the browser, if available.
UserClient - This defaults to "B" representing "browser".
Did not find what you were looking for?
If this content did not answer your questions, try searching or contacting our support team for further assistance.
Besides the entities you send to the CDP, the SDK collects the following additional information with each request:
UserAgent - This is collected from the browser, if available.
UserClient - This defaults to "B" representing "browser".
Did not find what you were looking for?
If this content did not answer your questions, try searching or contacting our support team for further assistance.