Skip to Content
Menu

attributionTracking()

This is a JavaScript method of tracking last-non-organic channel attribution. This can be used similar to the PHP utm() function but this JS function has the ability to send that data to third-party CRMs as well.

JavaScript March 21, 2023

Usage

This function runs automatically, so it is not called manually. Is this incorrect?

Additional Notes

Important: This function requires the “Attribution Tracking” Nebula Option to be enabled in order to use it! Be sure that the use of this cookie fits within your privacy policy and other regulations.

To send this data to third-party CRMs, make a hidden text input field with the class “attribution” in your CRM form. It will automatically get filled if that data exists.

To use it in a “local” form, you can do it the same way as above, but if you are using Contact Form 7 with Nebula no action is required unless you want that information to be sent in the email message. This attribution data will otherwise be stored automatically in Nebula’s Contact Form 7 Submissions admin page.

Was this page helpful? Yes No


    A feedback message is required to submit this form.


    Please check that you have entered a valid email address.

    Enter your email address if you would like a response.

    Thank you for your feedback!

    Source File

    Located in /assets/js/modules/measure.js on line 1858.

    No Hooks

    This function does not have any filters or actions available. Request one?
    JavaScript
    nebula.attributionTracking = function(){
        if ( nebula.site.options.attribution_tracking ){ //If the Nebula Option is enabled
            if ( nebula.isDoNotTrack() ){
                return false;
            }
    
            //Check if the cookie attribution exists to fill the respective input field
            if ( nebula.readCookie('attribution') && jQuery('input.attribution').length ){ //If our attribution cookie exists and we have an input to use
                jQuery('input.attribution').val(nebula.readCookie('attribution')); //Fill the designated form field(s)
            }
        }
    };
    

    Override

    To override or disable this JavaScript function, simply redeclare it with the exact same function name. Remember: Some functionality is conditionally loaded via dynamic imports, so if your function is not overriding properly, try listening for a DOM event (described below).

    JavaScript

    For non-module import functions:

    nebula.attributionTracking = function(){
        //Write your own code here, leave it blank, or return false.
    }


    For dynamically imported module function overrides:

    jQuery(window).on('load', function(){
        nebula.attributionTracking = function(){
            //Write your own code here, leave it blank, or return false.
        }
    });


    Custom Nebula DOM events do also exist, so you could also try the following if the Window Load listener does not work:

    jQuery(document).on('nebula_module_loaded', function(module){
        //Note that the module variable is also available to know which module specifically was imported
        if ( typeof nebula.attributionTracking === 'function' ){
            nebula.attributionTracking = function(){
                //Write your own code here, leave it blank, or return false.
            }
    	}
    });