There are a variety of ways to implement the Aggregated tracking code on your website. The method you choose will depend on the skill level, tools, and access available to the person doing the implementation. There are three main ways this tracking code can be implemented:
It is always best to include the Aggregated tracking code as high up on the page as possible so it fires as early as possible, but be mindful that specific data points about the purchase are needed for the tracking to work. These data points are:
[
{
item_id: "SKU12345",
item_name: "Product Name",
item_category: "Category Name or ID",
price: 33.00,
quantity: 3
},
{
item_id: " SKU67890",
item_name: "Another Product Name",
item_category: " Another Category Name or ID ",
price: 450.37,
quantity: 2
}
]
One of the most common ways to implement the Aggregated tracking code will be to hard-code it directly into your site code. This can be placed in the
or , but be sure that the data points are available at whatever place the code is placed. The Aggregated Purchase tag is needed for all plan types. The Aggregated Page tag is only needed for Enhanced Real-time plans.
<script src="https://code.aggregated-data.com/aggpurchasev2.js"></script>
<script>
var accountID = [insert account ID];
var aggRevenue = [insert revenue];
var aggOrderID = [insert order/transaction id];
var aggItems = [insert items array per spec];
aggpurchase();
aggproducts();
</script>
<script src="https://code.aggregated-data.com/aggpage.js"></script>
<script>
aggpage()
</script>
Probably the most common way the Aggregated tracking code is implemented is by using a tag management tool. The most common tag management tool is Google Tag Manager and the example below will describes the steps taken for a GTM implementation. Please note, the variables and syntax used for the Aggregated tracking code is the same as is used for Google Analytics 4 (GA4), so if you have GA4 implemented in GTM then you can use the same Trigger and Variables in the Aggregated tracking code.
The Aggregated Purchase tag is needed for all plan types. The Aggregated Page tag is only needed for Enhanced Real-time plans.
Aggregated Purchase tag:
<script src="https://code.aggregated-data.com/aggpurchasev2.js"></script>
<script>
var accountID = [insert account ID];
var aggRevenue = [insert revenue];
var aggOrderID = [insert order/transaction id];
var aggItems = [insert items array per spec];
aggpurchase();
aggproducts();
</script>
<script src="https://code.aggregated-data.com/aggpage.js"></script>
<script>
aggpage()
</script>
Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt explicabo. Nemo enim ipsam voluptatem quia voluptas sit aspernatur aut odit aut fugit, sed quia consequuntur magni dolores eos qui ratione voluptatem sequi nesciunt.
Lorem ipsum, dolor sit amet consectetur adipisicing elit. Quas, ea maiores laboriosam ratione accusamus veniam voluptatem quia suscipit, tempore aliquam, recusandae amet dolorum exercitationem esse sunt! Consequuntur ut illo autem.