Tracking new or repeat visitors using doplugin in appmeasurement for JS - Javascript Extension

Gold Contributor
Gold Contributor

Team,

We are planning to track the "new or repeat" visitors through doPlugins function. We have made all the initial configuration and the necessary settings to track those visitors from the plug in. However, Still we don't see the right data on the respective variable (Conversion variable). We feel like that we are missing or making some information incorrectly. We are using Tealium IQ as our tag management system and have added the plug in code under the java script extension. Also, using "Adobe Analytics App Measurement for JS" as a tag.

Please check the below and assist me to get the "new or repeat" visitors as expected.

----------------------------------Actual Code on my JavaScript extension---------------------

//initialize AppMeasurement

var s_account="ageo1xxlonsamplepeeranalytics";

var s=s_gi(s_account);

/******** VISITOR ID SERVICE CONFIG - REQUIRES VisitorAPI.js ********/

s.visitor=Visitor.getInstance("INSERT-MCORG-ID-HERE");

 

/************************** CONFIG SECTION **************************/

/* You may add or alter any code config here. */

/* Link Tracking Config */

s.trackDownloadLinks=true;

s.trackExternalLinks=true;

s.trackInlineStats=true;

s.linkDownloadFileTypes="exe,zip,wav,mp3,mov,mpg,avi,wmv,pdf,doc,docx,xls,xlsx,ppt,pptx";

s.linkInternalFilters="javascript:,tealiumecommerce.com"; //optional: add your internal domain here

s.linkLeaveQueryString=false;

s.linkTrackVars="None";

s.linkTrackEvents="None";

/*

* Plugin: getNewRepeat 1.2 - Returns whether user is new or repeat

*/

s.getNewRepeat=new Function("d","cn",""

+"var s=this,e=new Date(),cval,sval,ct=e.getTime();d=d?d:30;cn=cn?cn:"

+"'s_nr';e.setTime(ct+d*24*60*60*1000);cval=s.c_r(cn);if(cval.length="

+"=0){s.c_w(cn,ct+'-New',e);return'New';}sval=s.split(cval,'-');if(ct"

+"-sval[0]<30*60*1000&&sval[1]=='New'){s.c_w(cn,ct+'-New',e);return'N"

+"ew';}else{s.c_w(cn,ct+'-Repeat',e);return'Repeat';}");

/*

* Utility Function: split v1.5 (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");

s.usePlugins=true;

s.doPlugins=function(s) {

s.eVar13 = s.getNewRepeat(30,'s_getNewRepeat');

};

//s.doPlugins=s_doPlugins;

 

s.trackingServer="sstats.adobe.com";

s.trackingServerSecure="tealiumecommerce.sc.omtrdc.net";

------------------------------------------------------------------------------------------ -------------------------------------------------

Thank you,

Jay

3 REPLIES 3

Tracking new or repeat visitors using doplugin in appmeasurement for JS - Javascript Extension

Tealium Expert
Tealium Expert

Hi did you put this in your JS extensions of tealium?

If you did then that might be the issue.

What oyu have to do is go to the tag, 
Edit configuration scroll all the way to the bottom until you see "Advanced Settings" then click on Edit template
In here you input that code as instructed on adobes website

Plug-in Configuration
Place the following code within the s_doPlugins() function, which is located in the area of the s_code.js file labeledPlugin Config . Choose one Custom Traffic (s.prop) variable or one Custom Conversion (s.eVar) variable for use in capturing persisted value data. This should be a variable that has been enabled using the Admin Console, but which is not currently in use for any other purpose. You can use the following example and update it based on your requirements.

Once you edited the template save profile and publish to dev to test it.

Hope this helps

Damian Savvides

Tracking new or repeat visitors using doplugin in appmeasurement for JS - Javascript Extension

Gold Contributor
Gold Contributor

thanks for your reply. Now I have disbaled my javascript extension and added the code on the tag section. However, still it is not firing as expected. 

Suggestred -- Place the following code within the s_doPlugins() function, which is located in the area of the s_code.js file labeled Plugin Config .

Since I am using AppMeasurement for JS tag I don't find exact s_code.js. So I was trying to implement in above the appmeasurement fucntion call on the tag template and also in different format on the tag but still I don'tsee my prop4 is firing. 

Please suggest me to take necessary action to fire this plugin. 

Regards,
Jay.

Tracking new or repeat visitors using doplugin in appmeasurement for JS - Javascript Extension

Community Manager
Community Manager

@jayap3 Have you seen this article (and video) that shows how to add the doPlugins() code?

Configuring Adobe Analytics in Tealium iQ

Remember to "Accept as Solution" when your question has been answered and to give kudos to helpful replies.
Public