Hi Everyone,
Just want to check with you guys, I was wondering how to use two plugins with the single rule via custom script (or) Data element via (custom) to track both the campaign (getQueryParam) and Get Value Once (getValOnce).
For Example: Let say I am running a campaign where user reach to my page with "cid?=test" for the first time after that on the subsequent call if user reach to the same campaign within 30 days I don't want to track and get/pushthe value to any variables. If the user visit on the same campaign within 30 days, then we use getValOnce plugin to block the track for the specific duration.
Hope you understand my case.
Kindly help me if you have any reference links to fix this.
Vijay
Solved! Go to Solution.
Views
Replies
Total Likes
Ok so once thing to understand is that when Adobe first introduced Adobe Analytics or SiteCatalyst as it used to be known there were no tag management system or event common utility functions across Adobe products. In order to palliate this issue, Adobe Consulting created several utility plugins that relied on method used in core Adobe analytics library to write and read cookies for example. That is why in most instances the plugins were scoped to s object.
Having said that, it is a misconception that you need to use Adobe plugins to do what you need. You can write it yourself or you can also use Adobe Launch functionalities to do the same.
The default data element functionalities should allow you to do same outcome as some of the plugins:
For the plugin getQueryParam you can simply use this data element type:
Specify a single URL parameter in the URL Parameter field.
Only the name section is necessary and any special designators like “?” or “=” should be omitted
Now for getValOnce you can use the latest version of plugin. I checked it and there is one reference to c_r from Adobe Analytics that creates an issue but replacing it by cookieRead function fixes it just fine. Will report the issue to Adobe for a fix.
So in code you will see:
return e&&(k=k||"s_gvo",l=l||0,m="m"===m?6E4:864E5,e!==this.c_r(k))?(c=new Date,c.setTime(c.getTime()+l*m),cookieWrite(k,e,0===l?0:m),e):""};
replace this by
return e&&(k=k||"s_gvo",l=l||0,m="m"===m?6E4:864E5,e!==cookieRead(k))?(c=new Date,c.setTime(c.getTime()+l*m),cookieWrite(k,e,0===l?0:m),e):""};
And that should work without Adobe Analytics core library, I tested on a site without Adobe Launch and analytics and it works just fine.
So to use this solution what I would do it as follow:
//we consider that campaign query param data element is name paramCid //we consider that custom getValOnce is named getOnce _satellite.getVar('getOnce', {value: _satellite.getVar('paramCid'), name: "test", duration: 30}) //On first run it should return query param if exist //On second run with same query param value in next 30 days it should not return anything
Here you have a solution that does not depend on adobe analytics AppMeasurement and you can reuse getOnce data element to get value once for other values. Hope this helps
Warning:
I have noticed that getValOnce will return the value each time if the value is a number. The current plugin does exact evaluation to value and type needs to be the same and as cookie always return a string when it does let say 123 !== '123' it returns false... so 123 will always be returned.
For this scenario - I would suggest to use custom code approach in the actions part of the rule and with using the Analytics extensions set variable action type that allows you to set additional variables on the tracker. In custom code you can use doPlugins function which contains both getQueryParam and getValOnce plugins like below.
s.usePlugins = true; s.doPlugins = function () { /* Desired code */ s.campaign = getQueryParam("cmp") s.campaign = getValOnce(s.campaign,"cmp",30); } /* Plugin Section - Add plugin code here*/ s.getValOnce = function () s.getQueryParam = function()
Just for your info
If you only have simple query string parameter needs, Adobe recommends using the URL parameter features using tags in Adobe Experience Platform or the Util.getQueryParam() method included in AppMeasurement.
The doPluginsvariable acts as a ‘last call’ to set values in your implementation. If usePlugins is enabled, it automatically runs just before any type of image request is compiled and sent to Adobe, including:
Use the doPlugins variable to call plug-in code and set final variable values just before an image request is compiled and sent to Adobe.
Hope this helps.
Hi @Gokul_Agiwal,
Thanks for your quick response, sorry for not mentioned earlier query but this (s.usePlugins = true;) which is from AppMeasurement.
Since we moving to use AEP extension without using the legacy (AppMeasurement) or Adobe Analytics extension in the launch. In this case probably we use to go with custom code to map both the plugins in a single element to accommodate the above mentioned requirement. I would like to understand more on how to use those two new plugins (not legacy one) to get the values as expected.
Thanks again for all your information.
Regards,
Vijay
Views
Replies
Total Likes
@Vijayakumar_Raju_CBE , not sure what you mean by "legacy" plugins, but @Gokul_Agiwal's answer is the way to go. One suggestion I'd make is to use his code inside your Adobe Analytics extension's custom code, not inside a "Set Variables" action's custom code. By setting it in the extension's custom code, then the code will run with every beacon, so you're guaranteed to get the expected output regardless of which Rule got fired.
Hi @yuhuisg,
Legacy means (Old Plugins s.getValOnce/s.getQueryParam) which we usually used in AppMeasurement.js (or) Adobe Analytics extension (custom code) . Now we are using the new syntax without "s" from the beginning of the code (getValOnce/getQueryParam) . As I already described, I am not going to use Adobe Analytics Extension (custom code) or AppMeasurement.js file. Since we are going to use only AEP approach extension, where we use to combine those two plugin into one data element and mapped to XDM schema.
But I am still wondering it is not working as expected especially for this two plugins combined case/scenario . Anyway thanks for you information, let me create a ticket with adobe support team to sort out this issue then.
Regards,
Vijay
Views
Replies
Total Likes
It is not working as expected because those plugins are meant to be used with Adobe Analytics only, either with its extension or AppMeasurement.js.
If you want to use AEP's Web SDK with XDM schema, then you will need to "rewrite" these plugins by yourself to make them work.
Agree with @yuhuisg what he said. If you're using AEP web sdk extension then you need to write your own.
Views
Replies
Total Likes
Ok so once thing to understand is that when Adobe first introduced Adobe Analytics or SiteCatalyst as it used to be known there were no tag management system or event common utility functions across Adobe products. In order to palliate this issue, Adobe Consulting created several utility plugins that relied on method used in core Adobe analytics library to write and read cookies for example. That is why in most instances the plugins were scoped to s object.
Having said that, it is a misconception that you need to use Adobe plugins to do what you need. You can write it yourself or you can also use Adobe Launch functionalities to do the same.
The default data element functionalities should allow you to do same outcome as some of the plugins:
For the plugin getQueryParam you can simply use this data element type:
Specify a single URL parameter in the URL Parameter field.
Only the name section is necessary and any special designators like “?” or “=” should be omitted
Now for getValOnce you can use the latest version of plugin. I checked it and there is one reference to c_r from Adobe Analytics that creates an issue but replacing it by cookieRead function fixes it just fine. Will report the issue to Adobe for a fix.
So in code you will see:
return e&&(k=k||"s_gvo",l=l||0,m="m"===m?6E4:864E5,e!==this.c_r(k))?(c=new Date,c.setTime(c.getTime()+l*m),cookieWrite(k,e,0===l?0:m),e):""};
replace this by
return e&&(k=k||"s_gvo",l=l||0,m="m"===m?6E4:864E5,e!==cookieRead(k))?(c=new Date,c.setTime(c.getTime()+l*m),cookieWrite(k,e,0===l?0:m),e):""};
And that should work without Adobe Analytics core library, I tested on a site without Adobe Launch and analytics and it works just fine.
So to use this solution what I would do it as follow:
//we consider that campaign query param data element is name paramCid //we consider that custom getValOnce is named getOnce _satellite.getVar('getOnce', {value: _satellite.getVar('paramCid'), name: "test", duration: 30}) //On first run it should return query param if exist //On second run with same query param value in next 30 days it should not return anything
Here you have a solution that does not depend on adobe analytics AppMeasurement and you can reuse getOnce data element to get value once for other values. Hope this helps
Warning:
I have noticed that getValOnce will return the value each time if the value is a number. The current plugin does exact evaluation to value and type needs to be the same and as cookie always return a string when it does let say 123 !== '123' it returns false... so 123 will always be returned.
Views
Likes
Replies
Views
Like
Replies