• jonasborneland

    (@jonasborneland)


    Hi

    I tried to add an extra datalayer:

    function my_product_filter( array $eec_product, string $ecommerce_action ){
    // add an attribute only on product detail pages
    	if ( $ecommerce_action === "productdetail" ) {
    		$eec_product["dimension1"] = "Hello World"; // set a product scoped custom dimension
    	}
    
    	return $eec_product;
    }
    
    add_filter( 'gtm4wp_eec_product_array', 'my_product_filter', 10, 2 );

    But I cannot see it in the console when checking the page using adswerve chrome plugin.
    Eventually I wanted to add the product ID to the SKU like:
    “sku” => “theSKU_theProductId”
    Example: “93DKus_367865”
    instead of “93DKus”
    because my fb sync plugin transfer products as “theSKU_theProductId”.
    So my retargeting dont match the sku from gtm4wp right now

    I hope you can help ??

  • The topic ‘Add custom value to datalayer’ is closed to new replies.