Git Product home page Git Product logo

Comments (5)

eskfung avatar eskfung commented on July 21, 2024 1

Is this primarily to add abstraction to waiting for when the KM object is ready?

_kmq.push(function() {
    $.event.trigger("kmLoaded");
    // This function executes *because* KM has loaded
    // why not doStuff here?
});

from km-support.

jonazri avatar jonazri commented on July 21, 2024

In my particular use case, the abstraction provides better interoperability with my tag management platform's script firing conditions and (I think?) some timing / performance benefits as well.

BrightTag, the tag manager we are using, manages all events and data in one place to determine the conditions when any particular code block will execute without placing the entire burden on client-side JS. For my use it's convenient and efficient to have an event to bind to because there's a place for event firing conditions in their interface and their system deals with code optimization for me.

In general and for users with a more traditional setup, I would imagine pushing heavy functions to _kmq being something that slow things down a bit... but I'm by no means an expert in these things. Just figured others could find this useful if they either use a 3rd party tag manager, or if they would like timing to be managed outside of KM.

On Jul 18, 2013, at 5:13 PM, Eric Fung [email protected] wrote:

Is this primarily to add abstraction to waiting for when the KM object is ready?

_kmq.push(function() {
$.event.trigger("kmLoaded");
// This function executes because KM has loaded
// why not doStuff here?
});


Reply to this email directly or view it on GitHub.

from km-support.

eskfung avatar eskfung commented on July 21, 2024

Ah, good point. If tag managers get involved, I can see how this would be useful.

I can incorporate your explanation into an alternate version of http://support.kissmetrics.com/apis/javascript/javascript-specific/#callback-functions

from km-support.

eskfung avatar eskfung commented on July 21, 2024

071c6a1

from km-support.

woutersmet avatar woutersmet commented on July 21, 2024

Just wanna say that I was halfway through typing my request to support when I ran into the part in the kissmetrics docs where it said this trick. It's exactly what I needed and for similar reasons, so thanks both @eskfung and @jonazri!

from km-support.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.