[Skip to main content](#vessel-content)

#   Web Analytics for e commerce

##

- **[redcrecer](/forum/user/57743-redcrecer "View redcrecer's Profile")**
- [![redcrecer's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/57743-redcrecer "View redcrecer's Profile") Topic Author
- [ Offline](/forum/user/57743-redcrecer)

Less More

- Posts: 9
- Thank you received: 0
-
-

7 years 7 months ago [\#305734](#305734) by [redcrecer](/forum/user/57743-redcrecer "View redcrecer's Profile")  *[Web Analytics for e commerce](/forum/30-integrations/897305-web-analytics-for-e-commerce#305734 "Hello  I want to track this analytics code for e commerce report when the customer has finished the chekout.  ; gtag('event', 'purchase', { 'event&#95;category' : 'ecommerce', 'event&#95;label' : product&#95;name ?&gt; }); ;  My Question are:  Where can i put the script (file xxx.php,) ?  I want to track the product name of my shop, i dont know if ($row-&gt;product&#95;name) is right varible that i must use it. I hope your news  Kind Regads.")* was created by *[redcrecer](/forum/user/57743-redcrecer "View redcrecer's Profile")*

Hello

I want to track this analytics code for e commerce report when the customer has finished the chekout.

&lt;script language='javascript'&gt;;
gtag('event', 'purchase', { 'event_category' : 'ecommerce', 'event_label' : &lt;?php $row-&gt;product_name ?&gt; });
&lt;/script&gt;;

My Question are:

Where can i put the script (file xxx.php,) ?

I want to track the product name of my shop, i dont know if ($row-&gt;product_name) is right varible that i must use it.
I hope your news

Kind Regads.

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzMwLWludGVncmF0aW9ucy84OTczMDUtd2ViLWFuYWx5dGljcy1mb3ItZS1jb21tZXJjZT90bXBsPW1hcmtkb3du) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[nicolas](/forum/user/63-nicolas "View nicolas's Profile")**
- [![nicolas's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar63.png?1793428657)](/forum/user/63-nicolas "View nicolas's Profile")
- [ Away](/forum/user/63-nicolas)

Less More

- Posts: 86586
- Thank you received: 14325
-
-

7 years 7 months ago [\#305736](#305736) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[Web Analytics for e commerce](/forum/30-integrations/897305-web-analytics-for-e-commerce#305736 "Hello  I want to track this analytics code for e commerce report when the customer has finished the chekout.  ; gtag('event', 'purchase', { 'event&#95;category' : 'ecommerce', 'event&#95;label' : product&#95;name ?&gt; }); ;  My Question are:  Where can i put the script (file xxx.php,) ?  I want to track the product name of my shop, i dont know if ($row-&gt;product&#95;name) is right varible that i must use it. I hope your news  Kind Regads.")*

Hi,

You can add that code in the file "after_end" of the view "checkout" via the menu Display&gt;Views provided that you didn't enter a "return URL" in your payment method and that your payment method redirects you to the payment gateway at the end of the checkout for the payment.
If it's not the case, then you'll want to add the code int he file "end" of the view "checkout".
In both cases, you can find the products in the order in the array $this-&gt;order-&gt;products since you can have several products. So your code will have to be something like that: Code:

&lt;script language='javascript'&gt; &lt;?php foreach( $this-&gt;order-&gt;products as $row) { ?&gt; gtag('event', 'purchase', { 'event_category' : 'ecommerce', 'event_label' : '&lt;?php echo $row-&gt;order_product_name; ?&gt;' }); &lt;?php } ?&gt; &lt;/script&gt;

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzMwLWludGVncmF0aW9ucy84OTczMDUtd2ViLWFuYWx5dGljcy1mb3ItZS1jb21tZXJjZT90bXBsPW1hcmtkb3du) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

Board Categories HikaShop Install &amp; Update Product &amp; Category Display Content Creation Sales and Orders Orders management Reports &amp; Statistics Customers Checkout Payment Methods Shipping Methods Import &amp; Export (CSV, XLS…) Specific Features Affilation Taxes Wishlist Vote Carousel &amp; Slider Mass Actions Filters &amp; Search Discount &amp; Coupon Feature Request Integrations Showcase General Talk about HikaShop Development HikaShop 3.0 Beta Translation Commercial Jobs HikaShop Components HikaMarket Market: Feature requests Market: How to? Market: Bug Report HikaSerial General talk about HikaSerial Serial: Bug Report Serial: How to? Support en Français de HikaSerial (French Support) HikaSubscription HikaAuction Auction: Feature requests Auction: How to? Auction: Bug report Hikashop around the world Support en Français (French Support) Russian FAQ. Курс выживания с Hikashop. Частые вопросы и о Расширения Hikashop Наши сайты на Hikashop 日本語版サポート(Japanese Support) Thai German Archives Bug Report How to?

[](/forum/topics/feed/mode-topics?format=feed&type=rss)

Time to create page: 0.047 seconds

[Powered by](/forum/credits) [Kunena Forum](https://www.kunena.org)
