As we outline in this post and this post, Confection custom events can help users capture platform identifiers and prepare data for Facebook/Meta's Conversions API (CAPI) and Google Ads API. But these are just three specific applications of a more agnostic feature. You can use JSON-encoded Confection custom event values to create your own event-based custom objects and arrays. Organize data so it's convenient for you and customized for target endpoints.
We'll send updates directly to your email inbox.
Learn more about marketing disruptions involving cookies, cross-domain scripts, and device IDs. Get tips for using your Confection account effectively. Read customer experiences.
Short and powerful: confection.submitEvent("eventName", JSON.stringify({%Your Object/Array Here%}));
Confection custom event values support any JSON-encoded string. Use this feature to create your own event-based custom objects and arrays. Organize data so it's convenient for you and customized for target endpoints.
Educating yourself about privacy first disruptions and opportunities? Keeping an eye on the future of cookies, cross-domain scripts, and device IDs? We can help. Subscribe, and we’ll send content like this directly to your email inbox.
Confection automatically tracks the following kinds of events:
With a few lines of code, customers can also track eCommerce purchase events and send them directly to GA and Matomo. See this documentation for more information.
As we outline in our dashboard documentation, Confection also supports generic custom events. To submit a custom Confection event, use this syntax:
Add that above your site’s </head>
tag and below your Confection header code. For example, if you wanted to submit a custom event named click with a value of 1
, you’d add this to your site:
<script>
confection.submitEvent("click", 1);
</script>
In addition to integers and text strings, Confection custom event values also support JSON-encoded strings. Customers can use this feature to capture platform identifiers and to write Confection data to the CAPI and the Google Ads API. But these are just three specific applications of an agnostic feature. You can create any custom objects and arrays that are helpful to you.
Two examples follow.
URL parameters are incredible front-end workhorses. They can can help identify users. They can help sort, filter, or paginate content. They can pass search queries and serve product details or translated text. They can help track site activity and log campaign information.
Let's imagine you're using URL parameters to do several of these and that you want to associate relevant parameter values with Confection UUIDs.
Here's a URL with sample parameters:
http://www.example.com/page/?id=user-123&product=shirts&size=medium&language=en&campaign=paid-search
To log these parameters and organize them into a custom object, you could just add code like this below your Confection footer JS and above your site's closing </body>
tag:
Using the URL and sample parameters above, this will output to your Confection account as a custom event structured as follows:
From there, you can organize the data for input wherever you like: CRM, ad campaign, custom audience, analytics dashboard, &c.
Let's imagine you want to structure event data so it meets the schema requirements of a particular platform. Our CAPI and Google Ads API are examples of this in action. One other follows.
We know HubSpot's core analytics script is is frequently blocked. The script name varies by account number, but ours is https://js.hs-analytics.net/analytics/1692897900000/7349006.js
. When this script fails to fire, HubSpot users experience severe consequences:
banner.js
(eg., https://js.hs-banner.com/v2/7349006/banner.js
) also routinely fails to fire, which increases and compounds this particular risk.You can use a Confection custom event to ensure this data fires properly, and you can use a custom JSON object to easily prepare the payload for ingestion into the HubSpot API. As a simple example, let's assume we want to write pageview events and associated campaign data to HubSpot contact records. You could just add code like this below your Confection footer JS and above your site's closing </body>
tag:
This will use HubSpot first-party cookie data to identify the relevant user and pass the pageview and campaign details to your Confection account as a custom event structured as follows:
Note, this matches the data schema HubSpot API expects.
Today is your data independence day.
Take control of your pageviews, acquisition intel, and other "atomic-level" digital marketing data. Get +52-125% better analytics data, +20-30% more effective paid ads, and +88% larger audiences.
Questions or comments? Leave them below.
Get started. Risk free.