Doubleclick Javascript Error

Avatar

Avatar

michaelk6714623

Avatar

michaelk6714623

michaelk6714623

15-01-2017

Hi All,

I've installed the doubleclick integration into my development site. The console is reporting an uncaught error saying that s.partnerDFACheck is not a function. Has anybody seen this before and knows what might be causing this?

Accepted Solutions (1)

Accepted Solutions (1)

Avatar

Avatar

michaelk6714623

Avatar

michaelk6714623

michaelk6714623

15-01-2017

This is linked to implementing the code via DTM.

I have since made progress on the code and I will explain it here for the benefit of anybody who needs it. The way the code is designed seems to be in the wrong order where it presents the DFA Variables, the Code itself and then the plugins required. To make it work properly, it needs to be restructured so that it goes DFA Variables, Plugins and THEN the code. This ensures the variables called in the code are available. Here's the code which has worked for me so far when placed in Library Management (below).

 

 

/************************** DFA VARIABLES **************************/
/* @TODO: Fill in these variables with the settings mapped in the 
 * DFA wizard and that match your desired preferences. Some of the 
 * variables are optional and have been labeled as such below. 
 * @TODO: Comments should be removed in a production deployment. */
var dfaConfig = {
    CSID:               '', // DFA Client Site ID
    SPOTID:             'XXXXXXXX', // DFA Spotlight ID
    tEvar:              'XXXXXX', // Transfer variable, typically the "View Through" eVar.
    errorEvar:          'XXXXX', // DFA error tracking (optional)
    timeoutEvent:       'XXXXXX', // Tracks timeouts/empty responses (optional)
    requestURL:         "XXXXXX", // the DFA request URL
    maxDelay:           "XXXXXX", // The maximum time to wait for DFA servers to respond, in milliseconds.
    visitCookie:        "XXXXXX", // The name of the visitor cookie to use to restrict DFA calls to once per visit.
    clickThroughParam:  "XXXXXX", // A query string paramter that will force the DFA call to occur.
    searchCenterParam: XXXXXX, // SearchCenter identifier.
    newRsidsProp:       XXXXXX // Stores the new report suites that need the DFA tracking code. (optional)
};
/************************ END DFA Variables ************************/

/*
 * Partner Plugin: DFA Check 1.0 - Restrict DFA calls to once a visit, per report suite, per click 
 * through. Used in conjunction with VISTA. Deduplicates SCM hits.
 */
s.partnerDFACheck=new Function("cfg","" 
+"var s=this,c=cfg.visitCookie,src=cfg.clickThroughParam,scp=cfg.searchCenterParam,p=cfg.newRsidsProp,tv=cfg.tEvar,dl=',',cr,nc,q,g,gs,i,j,k,fnd,v=1,t=new Date,cn=0,ca=new Array,aa=new Array,cs=new A"
+"rray;t.setTime(t.getTime()+1800000);cr=s.c_r(c);if(cr){v=0;}ca=s.split(cr,dl);if(s.un)aa=s.split(s.un,dl);else aa=s.split(s.account,dl);for(i=0;i<aa.length;i++){fnd = 0;for(j=0;j<ca.length;j++){if(aa[i] == ca[j]){fnd=1;}}if(!fnd){cs[cn"
+"]=aa[i];cn++;}}if(cs.length){for(k=0;k<cs.length;k++){nc=(nc?nc+dl:'')+cs[k];}cr=(cr?cr+dl:'')+nc;s.vpr(p,nc);v=1;}if(s.wd)q=s.wd.location.search.toLowerCase();else q=s.w.location.search.toLowerCase();q=s.repl(q,'?','&');g=q.indexOf('&'+src.toLow"
+"erCase()+'=');gs=(scp)?q.indexOf('&'+scp.toLowerCase()+'='):-1;if(g>-1){s.vpr(p,cr);v=1;}else if(gs>-1){v=0;s.vpr(tv,'SearchCenter Visitors');}if(!s.c_w(c,cr,t)){s.c_w(c,cr,0);}if(!s.c_r(c)){v=0;}r"
+"eturn v>=1;"); 


/********************************************************************
 *
 * Supporting functions that may be shared between plug-ins
 *
 *******************************************************************/

/*
 * Utility Function: vpr - set the variable vs with value v
 */
s.vpr=new Function("vs","v",
"if(typeof(v)!='undefined' && vs){var s=this; eval('s.'+vs+'=\"'+v+'\"')}");

/*
 * Utility Function: split v1.5 - split a string (JS 1.0 compatible)
 */
s.split=new Function("l","d",""
+"var i,x=0,a=new Array;while(l){i=l.indexOf(d);i=i>-1?i:l.length;a[x++]=l.substring(0,i);l=l.substring(i+d.length);}return a");

/*
 * Plugin Utility: Replace v1.0
 */
s.repl=new Function("x","o","n",""
+"var i=x.indexOf(o),l=n.length;while(x&&i>=0){x=x.substring(0,i)+n+x.substring(i+o.length);i=x.indexOf(o,i+l)}return x");


/************************** DFA CODE START **************************/
s.maxDelay = dfaConfig.maxDelay;
s.loadModule("Integrate");
s.Integrate.onLoad=function(s,m) {
    var dfaCheck = s.partnerDFACheck(dfaConfig);
    if (dfaCheck) {
        s.Integrate.add("DFA");
        s.Integrate.DFA.tEvar=dfaConfig.tEvar;
        s.Integrate.DFA.errorEvar=dfaConfig.errorEvar;
        s.Integrate.DFA.timeoutEvent=dfaConfig.timeoutEvent;
        s.Integrate.DFA.CSID=dfaConfig.CSID;
        s.Integrate.DFA.SPOTID=dfaConfig.SPOTID;
        s.Integrate.DFA.get(dfaConfig.requestURL);
        s.Integrate.DFA.setVars=function(s,p) {
            if (window[p.VAR]) { // got a response
                if(!p.ec) { // no errors
                    s[p.tEvar]="DFA-"+(p.lis?p.lis:0)+"-"+(p.lip?p.lip:0)+"-"+(p.lastimp?p.lastimp:0)+"-"+(p.lastimptime?p.lastimptime:0)+"-"+(p.lcs?p.lcs:0)+"-"+(p.lcp?p.lcp:0)+"-"+(p.lastclk?p.lastclk:0)+"-"+(p.lastclktime?p.lastclktime:0)
                } else if (p.errorEvar) { // got an error response, track
                    s[p.errorEvar] = p.ec;
                }
            } else if (p.timeoutEvent) { // empty response or timeout
                s.events = ((!s.events || s.events == '') ? '' : (s.events + ',')) + p.timeoutEvent; // timeout event
            }
        }
    }
}


/************************** DFA CODE END **************************/

Answers (6)

Answers (6)

Avatar

Avatar

ocramrelsa

Avatar

ocramrelsa

ocramrelsa

22-10-2019

Hi,

We're experiencing the same error when implementing DFA with Launch (TypeError: e.partnerDFACheck is not a function).

Is there any solution to this in the meantime (changing the order of the code as proposed above did not make the trick for us)

Thanks, Marco

Avatar

Avatar

jantzen_belliston-Adobe

Community Manager

Total Posts

1.9K

Likes

312

Correct Answer

570

Avatar

jantzen_belliston-Adobe

Community Manager

Total Posts

1.9K

Likes

312

Correct Answer

570
jantzen_belliston-Adobe
Community Manager

06-02-2017

Michael,

Any luck testing out your code? 

Cheers,
Jantzen

Avatar

Avatar

jantzen_belliston-Adobe

Community Manager

Total Posts

1.9K

Likes

312

Correct Answer

570

Avatar

jantzen_belliston-Adobe

Community Manager

Total Posts

1.9K

Likes

312

Correct Answer

570
jantzen_belliston-Adobe
Community Manager

18-01-2017

Understood. Feel free to mark your own answer as correct once you've verified the solution.

Avatar

Avatar

michaelk6714623

Avatar

michaelk6714623

michaelk6714623

17-01-2017

I haven't tested the code yet, so hold off on doing that until I can confirm the implementation works.

Avatar

Avatar

jantzen_belliston-Adobe

Community Manager

Total Posts

1.9K

Likes

312

Correct Answer

570

Avatar

jantzen_belliston-Adobe

Community Manager

Total Posts

1.9K

Likes

312

Correct Answer

570
jantzen_belliston-Adobe
Community Manager

17-01-2017

Hi Michael,

Thank you for providing your code. Does this mean you were able to work out the issue on your own? If so, I'd like to mark your answer as correct for those who might also have this question in the future. 

 

Cheers,
Jantzen

Avatar

Avatar

ParitMittal

Avatar

ParitMittal

ParitMittal

15-01-2017

Hi Michael ,

Is the query linked to implementation of Double Click Tags i.e. Third Party Tag  via DTM or you are deploying the double click code by some other method ?

Thanks & Regards

Parit Mittal