활동이 없어 이 대화는 잠겼습니다. 새 게시물을 작성해 주세요.
활동이 없어 이 대화는 잠겼습니다. 새 게시물을 작성해 주세요.
Hi,
I have a page at:
http://www.threeekings.com/dtm/demosite/consumerJSON.html
There's a data layer with an element 'planCategory'. In the console, I can access the element's value by typing:
consumerJSON.planProfiles[0].planCategory
which returns:
"MAPD"
But when I try to create a data element to do the same thing, I get empty quotes:
_satellite.getVar('planCategory')
""
My attempts to create a functioning data element include:
- JS Object, with Path = window.consumerJSON.planProfiles[0].planCategory
- JS Object, with Path = consumerJSON.planProfiles[0].planCategory
- Custom Script, with window.consumerJSON.planProfiles[0].planCategory in the editor
So far, all of the above are giving me
or
in the console
Any ideas what I could do differently so that the data element populates with
"MAPD" ?
Thanks!
해결되었습니다! 솔루션으로 이동.
조회 수
답글
좋아요 수
Hey Frank,
So, the problem is that when you use a js Object reference, the path can't contain bracket accessors to an array element. So, you can use a custom script which you would do what you were doing above:
return window.consumerJSON.planProfiles[0].planCategory;
Try that out and see if it works. 🙂
Ben
조회 수
답글
좋아요 수
I don't see that data element defined:
[img]Screen Shot 2014-06-06 at 12.05.44 PM.PNG[/img]
조회 수
답글
좋아요 수
Sorry, it was un-published and I was using the testing plugin to access the staging DTM tag.
Should be there now...
Thanks!
조회 수
답글
좋아요 수
Hey Frank,
So, the problem is that when you use a js Object reference, the path can't contain bracket accessors to an array element. So, you can use a custom script which you would do what you were doing above:
return window.consumerJSON.planProfiles[0].planCategory;
Try that out and see if it works. 🙂
Ben
조회 수
답글
좋아요 수
Ben,
That worked beautifully, thank you!
Frank.
조회 수
답글
좋아요 수
That's great! You are welcome.
Will you go ahead and select that as the correct answers for future community comers?
Thanks,
Ben
조회 수
답글
좋아요 수
조회 수
Likes
답글