Craft\InstantAnalyticsService::addCommerceProductDetailView PHP Method

addCommerceProductDetailView() public method

Add a product detail view from a Craft Commerce Product or Variant
public addCommerceProductDetailView ( IAnalytics $analytics = null, $productVariant = null )
$analytics IAnalytics the Analytics object
    public function addCommerceProductDetailView($analytics = null, $productVariant = null)
    {
        if ($productVariant) {
            if ($analytics) {
                $productData = $this->getProductDataFromProduct($productVariant);
                // Don't forget to set the product action, in this case to DETAIL
                $analytics->setProductActionToDetail();
                //Add the product to the hit to be sent
                $analytics->addProduct($productData);
                InstantAnalyticsPlugin::log("addCommerceProductDetailView for `" . $productData['sku'] . "` - `" . $productData['name'] . "` - `" . $productData['name'] . "`", LogLevel::Info, false);
            }
        }
    }