Skip to content
This repository was archived by the owner on Apr 28, 2022. It is now read-only.
This repository was archived by the owner on Apr 28, 2022. It is now read-only.

Typeerror: analytics.push is not a function (firefox 23.0.1) #253

@mickdelaney

Description

@mickdelaney

I'm getting a problem with the script loader on firefox.
Its happening intermittently.

its happening on the line below in the script loader from usedhttps://segment.io/libraries/analytics.js.

any ideas?

<script type="text/javascript"> // Create a queue, but don't obliterate an existing one! var analytics = analytics || []; (function () { // A list of all the methods we want to generate queueing stubs for. var methods = [ 'identify', 'track', 'trackLink', 'trackForm', 'trackClick', 'trackSubmit', 'page', 'pageview', 'ab', 'alias', 'ready', 'group' ]; // For each of our methods, generate a queueing method that pushes arrays of // arguments onto our `analytics` queue. The first element of the array // is always the name of the analytics.js method itself (eg. `track`), so that // we know where to replay them when analytics.js finally loads. var factory = function (method) { return function () { analytics.push([method].concat(Array.prototype.slice.call(arguments, 0))); }; }; for (var i = 0; i < methods.length; i++) { analytics[methods[i]] = factory(methods[i]); } }()); // Define a method that will asynchronously load analytics.js from our CDN. analytics.load = function (apiKey) { // Create an async script element for analytics.js based on your API key. var script = document.createElement('script'); script.type = 'text/javascript'; script.async = true; script.src = ('https:' === document.location.protocol ? 'https://' : 'http://') + 'd2dq2ahtl5zl1z.cloudfront.net/analytics.js/v1/' + apiKey + '/analytics.min.js'; // Find the first script element on the page and insert our script next to it. var firstScript = document.getElementsByTagName('script')[0]; firstScript.parentNode.insertBefore(script, firstScript); }; // Load analytics.js with your API key, which will automatically load all of the // analytics integrations you've turned on for your account. Boosh! analytics.load('mycode'); </script>

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions