Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Fetch page values dynamically?

Tags:

asp.net

I was wondering if someone could point me in the right direction. We are running an .NET e-commerce website via nopCommerce 3.5 and would like to enable Google remarketing code fully. We included the Google remarketing code BUT it is static - i.e we put it in on the header of the site and it works - its in every page BUT it is hard coded and refers to a single item on our site.

I am trying to work out how to make the remarketing code dynamic. I.e each page would fetch its own values dynamically via .NET or SQL.

Google remarketing code is looking for:

  1. ecomm_prodid: 'REPLACE_WITH_VALUE',
    (I think this is a product id)
  2. ecomm_pagetype: 'REPLACE_WITH_VALUE',
    (I think this is page type)
  3. ecomm_totalvalue: 'REPLACE_WITH_VALUE',
    (I think this is total value)

How would I get each product page to retrieve 3 values and place them on the product page instead of REPLACE_WITH_VALUE? (Even if its only one - the product ID)?

Screenshot

We have an awful lot of products on our site, but maybe I could manually code in the best sellers. I don't know to go about this problem. Any help is much appreciated.

like image 581
Andrew Avatar asked Feb 20 '26 17:02

Andrew


1 Answers

Looking at the nopcommerce code on CodePlex, the ProductDetailModel has a submodel AddToCartModel which in turn has a member ProductId. You should be able to use this field to fill you GA variable with it, like this: ecomm_prodid:'<%#this.AddToCart.ProductId%>';. The same should apply to the price, using ecomm_productvalue:'<%#this.ProductPrice.Price%>';

like image 196
svanelten Avatar answered Feb 23 '26 07:02

svanelten



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!