Information for: DEVELOPERS   PARTNERS   SUPPORT

Sending custom attributes

The Customer Data Platform (CDP) Webtag also supports sending custom attributes on the standard CDP entities (described in the section above), or sending custom events based on your business needs.

CDP application needs to be first configured with these custom events/ attributes before they can be part of the event payload of the webtag. Those attributes can include pretty much any information that is available for and of the standard entities on your website (e.g. the payment method used by a customer for their transactions, etc…).

Important

If you are not sure whether those attributes have been configured yet in the CDP platform, please sync-up with your CDP team and do not try to implement those attributes in your installation of the webtag. This could lead to API errors on your pages, with no events being sent to CDP.

Sending custom attributes on standard entities

As with the rest of the attributes on any entities, please remember that you should send that information via the webtag only if it is considered to be the source of truth for that data. Otherwise, if that information also comes from other sources, it will most likely get overwritten by that other source, as we always take the latest values regardless of the data source.

Events, Customer, Transaction, Target entities

For our example below, we will assume that you are implementing a custom attribute named “paymentMethod” with a value of “Visa” on a transaction entity.

As detailed in the section “CDP Webtag - CDP entities”, all the standard entities implemented by the SDK models support custom attributes. A code implementation of this on your page would look like the following :

<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>