Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <script>
- require(['jquery'], function ($)
- {
- $(".tocart").click(function()
- {
- dataLayer.push({
- 'event': 'addToCart',
- 'ecommerce': {
- 'currencyCode': 'USD',
- 'add': {
- 'products': [{
- 'name': "<?php echo "$google_item_name $google_item_name_2 $google_item_name_3";?>", // Name or ID is required
- 'id': '<?php echo "$google_sku";?>', // Name or ID is required
- 'price': '<?php echo "$google_price";?>', // Insert product price
- 'brand': '<?php echo "google_site_owned_by_name";?>', // Insert product brand
- 'category': '<?php echo "$category_name";?>', // Insert product category
- 'quantity': '1', // Insert product quantity
- 'site': '<?php echo "$google_sitebeing_viewed";?>' // Insert site that product belongs to (e.g. site1, site2, site3)
- }]
- }
- }
- });
- });
- });
- </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement