Documentation You are here: start » v » 2.0 » analytics

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
v:2.0:analytics [2024/07/12 16:42] – [Event Values] adamv:2.0:analytics [2025/09/05 13:34] (current) – [Google Tag Manager] adam
Line 61: Line 61:
  
 If there are any other events that you want to track, these will need to be handled yourself manually. If there are any other events that you want to track, these will need to be handled yourself manually.
- 
-=== Event Values === 
  
 For any events that include a ''value'', the total item price is used. For the ''purchase'' event, shipping and taxes are also passed as separate attributes in the event payload. For any events that include a ''value'', the total item price is used. For the ''purchase'' event, shipping and taxes are also passed as separate attributes in the event payload.
Line 78: Line 76:
  
 You can see [[https://developers.google.com/analytics/devguides/collection/ga4/ecommerce?client_type=gtag#view_item_details|details on the ''view_item'' event on the GA4 documentation here]]. You can see [[https://developers.google.com/analytics/devguides/collection/ga4/ecommerce?client_type=gtag#view_item_details|details on the ''view_item'' event on the GA4 documentation here]].
 +
 +=== Item data ===
  
 As a reference, for the Foxy integration, we pass the following attributes for ''items'' in GA4 ecommerce event calls: As a reference, for the Foxy integration, we pass the following attributes for ''items'' in GA4 ecommerce event calls:
Line 86: Line 86:
   * ''quantity''   * ''quantity''
   * ''item_id'' (if the item has a ''code'' attribute)   * ''item_id'' (if the item has a ''code'' attribute)
 +
 +It is possible to override some of these values, or pass additional data to GA4 within the item data, by passing special reserved product options that are prefixed with ''_ga_'' in your add to carts. You can [[v:2.0:cheat_sheet#https://wiki.foxycart.com/v/2.0/cheat_sheet#special_product_options|see more information on the supported options here]].
  
 ==== Google Tag Manager ==== ==== Google Tag Manager ====
Line 104: Line 106:
  
 Specifically for GTM, there is also one additional custom event for ''virtual_page_view''. This is triggered when the Sidecart is opened, along with when the cart, checkout and receipt are loaded. It's up to you if you want to include this for your set up to track clean URL's for the page views for those aspects as well, instead of the default page view. The dataLayer for this event passes a ''virtual_page_location'' parameter with the clean URL, along with a ''virtual_page_title'' parameter to match to the ''page_title'' for the page view event. Note that for events that occur on your website (for example, for ''add_to_cart'', ''remove_from_cart'' or ''view cart'' that happen via the Sidecart), the ''virtual_page_location'' will be your website URL. Specifically for GTM, there is also one additional custom event for ''virtual_page_view''. This is triggered when the Sidecart is opened, along with when the cart, checkout and receipt are loaded. It's up to you if you want to include this for your set up to track clean URL's for the page views for those aspects as well, instead of the default page view. The dataLayer for this event passes a ''virtual_page_location'' parameter with the clean URL, along with a ''virtual_page_title'' parameter to match to the ''page_title'' for the page view event. Note that for events that occur on your website (for example, for ''add_to_cart'', ''remove_from_cart'' or ''view cart'' that happen via the Sidecart), the ''virtual_page_location'' will be your website URL.
 +
 +=== GTM ''daterLayer'' event ===
 +
 +If you want to add custom tracking for GTM to pass through additional values than what Google Analytics/Ads needs - for example for other integrations - you can do that using the ''analytics-gtm-datalayer'' JS event. You can see details on using this event [[.:javascript#eventswhat_they_are_and_how_to_use_them|within our javascript events documentation]].
 +
 +As a quick example, this would add an additional parameter called ''foo'' with a value of ''bar'' to be sent with the dataLayer's data:
 +
 +<code javascript>
 +FC.client.on('analytics-gtm-datalayer', function(params) {
 +    params.event_data.foo = "bar";
 +});
 +</code>
  
 === GTM Screenshots === === GTM Screenshots ===

Site Tools