Help Center Implementation

How to Implement the Aggregated Tracking Code

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:

  1. Directly in your site code
  2. Using a tag management tool
  3. Shopify sites, use the self-contained Shopify script Go there now ->

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:

  • Account ID - as a string data type (ex. "abcdefg1234hij")
  • Revenue - as a number data type (ex. 45.55)
  • Order/Transaction ID – as a string data type (ex. "12345" or "#12345")
  • Product details for the order – as an array with some or all of the following
    • item_id - as a string data type (ex. "SKU12345")
    • item_name - as a string data type (ex. "Product Name")
    • item_category – as a string data type (ex. "Category Name or ID")
    • price - as a number data type (ex. 33.00)
    • quantity - as a number data type (ex. 3)
Below is a full example of the product details array. The syntax is the exact same as that used by Google Analytics 4 (GA4) for the items array.

 [
{
      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
    }
]


Directly in your site code

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.

Aggregated Purchase tag:
The code below needs to be placed on your order confirmation page at a point where the data points for revenue, order/transaction id, and product details are available.


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


Aggregated Page tag (only for Enhanced Real-time plans):
The code below needs to be place on every page load. If you have a Single Page Application or Progress Web App (SPA or PWA) it only needs to be placed on the initial (and only) page load.


<script src="https://code.aggregated-data.com/aggpage.js"></script>
<script>
 aggpage()
</script>

Using a tag management tool

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:

  1. Created a new Custom HTML tag
  2. Paste in the code below:
  3. 
    <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> 
    
    
  4. Replace the placeholder references (denoted by brackets such as [insert revenue]) with the variables which contains the associated data point
  5. Add the trigger for your purchase event or order confirmation page load
  6. Save tag
  7. If you have the Standard Real-time plan then Publish the new tag you created and log in to your dashboard at: https://www.aggregated.io/sign-in.html to start to see your data (the dashboard will update as soon as an order is tracked).. If you have the Enhanced Real-time plan then skip to the next set of steps before publishing.

Aggregated Page tag (only for Enhanced Real-time plans):
  1. Created a new Custom HTML tag
  2. Paste in the code below:
  3. 
    <script src="https://code.aggregated-data.com/aggpage.js"></script>
    <script>
     aggpage()
    </script>
    
    
  4. Add the trigger All Pages
  5. Save tag
  6. Publish the new tags you created and log in to your dashboard at: https://www.aggregated.io/sign-in.html to start to see your data (the dashboard will update as soon as an order is tracked).

Shopify sites

Small heading for a smaller transition

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.