0

I've a kind of weird question. I have set up google publishing tag on my website. The key values that are saved in google publishing tag can be accessed directly in the console by typing in this:

googletags.pubads()

Now the above is an object containing different objects , methods etc. However , from time to time the location of a particular object inside googletag.pubads() changes. If the object or array I am looking for inside google.pubads() is in i'th position today , then after like a few months the location of the same object is "j" . Why would this be?

This is how I access it in console:

var s = googletag.pubads();
var q = s.i // Because the current object is in "i" . However it changes after a few months. or days.

I am using the value of this object in many different places & if the position changes , then I have to update my code with the new object location everytime it changes. Why would this happen?

user3582550
  • 1
  • 1
  • 1
  • 3
  • What's `i` in this case? I'd suggest carefully reading the [api docs](https://support.google.com/dfp_premium/answer/1650154?expand=googletag_details#pubads). If `i` is supposed to be a numerical index, then know that the order of properties in a object in javascript is not guaranteed. – Matt Burland Apr 28 '14 at 18:35
  • Then in that case , is there any way I can automatically know when the order has changed? Because everytime I manually need to check & update my code – user3582550 Apr 28 '14 at 18:56
  • I checked the API docs. I do setTargeting() ie add keys and values. & whatever key values I enter in set Targeting , appear as an object inside "i" inside googletag.pubads(). I'm not sure as its' not mentioned in the docs but I guess "i" refers to numerical index. – user3582550 Apr 28 '14 at 19:06
  • @user3582250: No. The answer is to not rely on the ordering. But your question doesn't have enough detail and I'm not familiar with that API. – Matt Burland Apr 28 '14 at 19:14
  • oh. Wondering what would be the way out if the ordering of the properties is not guaranteed in js. I don't want to update things manually. – user3582550 Apr 28 '14 at 19:17

0 Answers0