So apparently Google changed something in their DFP gpt.js library and it seems it doesn't work with Ember anymore when trying to load gpt.js programmatically (please read further).
So, if the gpt.js file is loaded into the index.html file, before all vendor.js/app.js files that Ember uses to load/start the application, everything works great (ads are shown, the application runs smoothly).
If you want to load that file programmatically (via Ajax load, or via document.createElement, etc), something that apparently was modified in Google's gpt.js conflicts with something from Embers String extension. To be more specific:
ember-runtime/ext/string
/**
See [Ember.String.w](/api/classes/Ember.String.html#method_w).
@method w
@for String
@private
*/
StringPrototype.w = function () {
return _emberRuntimeSystemString.w(this);
};
For whatever reason, the String.prototype.w method is conflicting with a w() method from Google's gpt.js file and an error is trown.
I am closing as you seem to have arrived at the correct solution, and we have demonstrated the intent of deprecating Ember.String prototype extensions in RFC 236.
Thank you for reporting!
Hi,
So apparently Google changed something in their DFP gpt.js library and it seems it doesn't work with Ember anymore when trying to load gpt.js programmatically (please read further).
So, if the gpt.js file is loaded into the index.html file, before all vendor.js/app.js files that Ember uses to load/start the application, everything works great (ads are shown, the application runs smoothly).
If you want to load that file programmatically (via Ajax load, or via document.createElement, etc), something that apparently was modified in Google's gpt.js conflicts with something from Embers String extension. To be more specific:
For whatever reason, the String.prototype.w method is conflicting with a
w()
method from Google's gpt.js file and an error is trown.Our current fix was to disable the String extension done by ember in the ENV file using https://emberjs.com/api/ember/2.8/namespaces/Ember.String (EmberENV.EXTEND_PROTOTYPES.String = false).
gpt.js - https://www.googletagservices.com/tag/js/gpt.js