The free connector for Brevo (formerly sendinblue) includes covers the tracking APIs as Invantive stored procedures, on top of the tables available for reading and writing data stored in Brevo. An example of maintaining contact lists can be found in Fast loading of contacts with lists in Brevo (formerly sendinblue).
There are four stored procedures available in the package sib_tracker
:
identify
: register a user of a application as contact in Brevo. Can also create a new contact when the email address did not exist previously.track_event
: register an event to initiate or control a marketing automation or transactional emails on the contact.track_link
andtrack_page
: register a web click and page visit.
All tracking APIs allow the user to change the values of custom fields using a JSON value as shown below through contact attributes. Additionally, the track_event
enables sending event data to Brevo for use in an automation.
The use of the tracking APIs requires the automation key to be specified on log on, the connection string property ‘automation-key’ or by setting it using the set
statement. The automation key is different from the API key, since the automation key is actually made publically available in for instance JavaScript files on web servers.
The following code sample illustrates the use:
declare
l_email varchar2 := 'john.doe@acme.com';
begin
--
-- Identify a new or previously registered contact.
--
sib_tracker.identify(l_email, '{"FIRSTNAME": "John", "LASTNAME": "Doe"}');
--
-- Register an event to start an automation.
--
sib_tracker.track_event
( l_email
, 'test'
, '{"FIRSTNAME": "John", "LASTNAME": "Doe3"}'
, '{ "eventdata": { "element1": "value1", "element2": "value2" }}'
);
--
-- Register a click on a link or a web page visited.
-- Properties of the contact can be specified too, as seen above.
--
sib_tracker.track_link(l_email, 'https://nu.nl/click', '{}');
sib_tracker.track_page(l_email, 'https://nu.nl/pagepath', '{}');
end;