I'm helping a client getting Google Analytics and AdWords e-commerce tracking running on his Merchello setup.
Using Google Tag Manager.
But I'm having problems.
When placing a test order I get the following error
Compilation Error
Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.
Compiler Error Message: CS1012: Too many characters in character literal
Source Error:
Line 137: @foreach (var item in Model.Items.Where(x => x.LineItemType == LineItemType.Product))
Line 138: {
Line 139: 'products': [{ // List of productFieldObjects.
Line 140: 'name': '@item.Name', // Name or ID is required.
Line 141: 'id': '@item.Sku',
I'm suspecting, that the curly boys { } in the within the foreach loop is causing the error, but I'm not experienced enough to just fix it.
Hope any of you guys can help, because I havent been able to find any similar posts about this.
Did you manage to resolve this? I only just noticed your post whilst investigating some issues i'm also having with integrating GA ecommerce with Merchello.
pushing product data on pageview can be done like this, if it helps?
<script>
dataLayer.push({
'ecommerce': {
'impressions': [
{
@foreach(var product in Model.Products)
{
var name = product.Name;
var id = product.Sku;
var price = product.Price;
var brand = "test";
var category = "test";
var list = "test";
<text>'name': '@name', 'id': '@id', 'price': '@price', 'brand': '@brand', 'category': '@category' ,'list': '@list'</text>
}
}],
}
});</script>
Google Analytics e-commerce tracking in Merchello
Hi guys
I'm helping a client getting Google Analytics and AdWords e-commerce tracking running on his Merchello setup.
Using Google Tag Manager.
But I'm having problems.
When placing a test order I get the following error
I'm suspecting, that the curly boys { } in the within the foreach loop is causing the error, but I'm not experienced enough to just fix it.
Hope any of you guys can help, because I havent been able to find any similar posts about this.
Best
Henrik
Hi Henrik,
Did you manage to resolve this? I only just noticed your post whilst investigating some issues i'm also having with integrating GA ecommerce with Merchello.
pushing product data on pageview can be done like this, if it helps?
Kerri
Hi Kerri
Thanks a lot for your reply.
I'm gonna give it a go next week.
Best
Henrik
Hi Henrik,
In that case, can I offer an amendment to the previous code (after more testing it wasn't quite right)
The below is how we can get a product impression pushed to the data layer for each of the products on the product list page:
Hope it goes well! Kerri
is working on a reply...