Description Usage Arguments Details Value Examples
A helper function to build enhanced ecommerce hits
1 2 3 4 5  | 
action | 
 The role of the products included in a hit. Required.  | 
transaction_id | 
 An id for the transaction. Required.  | 
revenue | 
 The total value of the transaction  | 
product_sku | 
 A vector of product SKU  | 
product_name | 
 A vector of product names  | 
product_brand | 
 A vector of product brands  | 
product_category | 
 A vector of product category  | 
product_price | 
 A vector of product price  | 
This lets you more easily create enhanced ecommerce hits by creating an object you then pass into other hits such as gmr_hit_event
The product arguments such as product_sku are vectors that will be turned into lists via gmr_enhanced_index. If passing multiple arguments, they each must have the products in the same order and be the same length.
If you want to pass your own indexed products, gmr_enhanced_index can be used to create a named list which you can then append to the paramters generated using do.call. See examples.
An gmr_ee object that can be passed to gmr_hit_x functions.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17  | gmr_hit_page(url_path = "/checkout",
             enhanced_ecom = gmr_enhanced_ecom("purchase", transaction_id = "blah223", revenue = 4300.23, product_sku = c("sku4","sku23","sku7")))
# Make your own hit
my_promotion_id <- gmr_enhanced_index(c("aff3","aff2","aff2"), prefix = "promo", suffix = "id")
# make your own enhanced ecom obj
my_ee <- do.call(gmr_enhanced_ecom,
                 args = c(list(action = "purchase",
                              transaction_id = "2323",
                              product_sku = c("sku4","sku3","sku7")
                              ),
                         my_promotion_id)
                         )
# register hit
gmr_hit_page(url_path = "/checkout-thanks", enhanced_ecom = my_ee)
 | 
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.