I tried the follwoing code
ga('create', 'UA-111563164-2', 'auto');
ga('require', 'ec');
ga('ec:addImpression', { // Provide product details in an impressionFieldObject.
'id': 'trip-to-fairy-meadows-and-nanga-parbat-base-camp-by-directions-explore-with-us', // Product ID (string).
'name': 'TRIP TO FAIRY MEADOWS AND NANGA PARBAT BASE CAMP', // Product name (string).
'brand': 'DIRECTIONS - EXPLORE WITH US', // Product brand (string). // Product variant (string).
'category': 'Apparel/T-Shirts',
'variant': 'black',
'list': 'Search Results',
'position': 1
});
ga('ec:addImpression', {
'id': 'P67890',
'name': 'YouTube Organic T-Shirt',
'category': 'Apparel/T-Shirts',
'brand': 'YouTube',
'variant': 'gray',
'list': 'Search Results',
'position': 2
});
ga('send', 'pageview');
The code is written in angular 4 and i am using angulartics2 library. the data is not push toward to the google analytics.
Your code looks fine and should work as intended. The reason you are not seeing any data is likely because Google Analytics data processing latency.
Processing latency is 24-48 hours. Standard accounts that send more than 200,000 sessions per day to Analytics will result in the reports being refreshed only once a day. This can delay updates to reports and metrics for up to two days. To restore intra-day processing, reduce the number of sessions your account sends to < 200,000 per day.
For Analytics 360 accounts, this limit is extended to 2 billion hits per month.
More in Google Analytics official documentation: https://support.google.com/analytics/answer/1070983?hl=en