Expand my Community achievements bar.

Join us January 15th for an AMA with Champion Achaia Walton, who will be talking about her article on Event-Based Reporting and Measuring Content Groups!
SOLVED

Common Plugins Get Previous Value and New/Repeat Visitor Implementation

Avatar

Level 2

I have installed the 'Common Analytics Plugins Extension'


Created a Rule - Initialize Plugin's

KMahesh_0-1620638653994.png

and another Rule - Initialize Time Plugin

KMahesh_2-1620638846743.png

and in-browser console I am getting the function definitions as well.
This always returning the NEW instead of repeat.

KMahesh_1-1620638806263.png

 

but in the Cookies section - the gpv_pn cookie is not getting added, so based on this the previous page name not getting added. Once it will be drop, then with the help of the below code, will track the data.

 

 

s.prop9 = s.getPreviousValue(s.pageName,'gpv_pn');
s.linkTrackVars = "prop9";

 

 

 

Tried the Alternative approach as well.

Created one Common Plugin Rule and disabled the above two rules - 

 

KMahesh_3-1620639659007.png

 

then added the required things 

KMahesh_4-1620639705232.png

 

getting the same result in the console as well, but the gpv_pn cookie not dropping on the page

KMahesh_5-1620639744624.png

KMahesh_6-1620639787144.png

Please let me know if I missed something.

 

Thanks in advance.

 

 

 

 

 

 

1 Accepted Solution

Avatar

Correct answer by
Level 4

@PratheepArunRaj Thanks for Adding me in.

@KMaheshAdobe recommends using the individual plugin actions instead of  initializing all plugins in single action due to the increase in weight(size) of the extension.
Coming to queries
1. s.getPreviousValue getting undefined & gpv_pn cookie not setting.
   

If we call s.getPreviousValue() without passing arguments we will get undefined only, we have to pass the arguments like s.getPreviousValue(s.pageName,"gpv_Page") as per requirement.

From the details (screen grabs) shared i assume that you're trying to set s.prop1 with previous pageName value. For this we have to define like this s.prop9 = s.getPreviousValue(s.pageName,'gpv_pn'); and make sure that your setting this after s.pageName is defined, if you call "s.getPreviousValue(s.pageName,'gpv_pn');" before defining s.pageName it won't set cookie as s.pageName is getting undefined.

2. s.getNewRepeat();
   getNewRepeat() will return the visitor as "New" throughout visit(first visit after getNewRepeat is implemented) and from next visit it will return the visitor as "Repeat" till the cookie gets expired.


Thanks,
Charles

View solution in original post

13 Replies

Avatar

Community Advisor and Adobe Champion
Can you help here? Thanks much.

Avatar

Correct answer by
Level 4

@PratheepArunRaj Thanks for Adding me in.

@KMaheshAdobe recommends using the individual plugin actions instead of  initializing all plugins in single action due to the increase in weight(size) of the extension.
Coming to queries
1. s.getPreviousValue getting undefined & gpv_pn cookie not setting.
   

If we call s.getPreviousValue() without passing arguments we will get undefined only, we have to pass the arguments like s.getPreviousValue(s.pageName,"gpv_Page") as per requirement.

From the details (screen grabs) shared i assume that you're trying to set s.prop1 with previous pageName value. For this we have to define like this s.prop9 = s.getPreviousValue(s.pageName,'gpv_pn'); and make sure that your setting this after s.pageName is defined, if you call "s.getPreviousValue(s.pageName,'gpv_pn');" before defining s.pageName it won't set cookie as s.pageName is getting undefined.

2. s.getNewRepeat();
   getNewRepeat() will return the visitor as "New" throughout visit(first visit after getNewRepeat is implemented) and from next visit it will return the visitor as "Repeat" till the cookie gets expired.


Thanks,
Charles

Avatar

Level 2

Hi @Charles_Thirupathi,

Thanks for your reply.

 

Yes, I agree like Adobe recommended using the individual plugins. I tried this at first, but it was not working, that's why followed that approach as well.

 

Yes we have to call the s.getPreviousValue(s.pageName,"gpv_Page") after setting of page name only.

Followed the same steps.

Created one Page Bottom Rule - in which I am passing the page name via data layer.

KMahesh_0-1620657969358.png

 

KMahesh_1-1620657999421.png

 

After this Rule, Created one Window load rule, in which I passed the below code

s.prop9 = s.getPreviousValue(s.pageName,'gpv_pn');
s.linkTrackVars = "prop9";

 

and tried with the Extension - Configure Tracker Using Custom Code as well

No Luck. No cookie adding.

 

Thanks,

 

@KMahesh Are you defining s.pageName as well?  before calling s.getPreviousValue(s.pageName,'gpv_pn'); ? because screenshot shows that you're capturing pageName in eVar4. If s.pageName is not defined then pass s.eVar4 as argument instead of passing s.pageName like s.getPreviousValue(s.eVar4,'gpv_pn');

Avatar

Level 2

Hi @Charles_Thirupathi,

 

Generic Page load Rules triggers at the bottom in which we are getting the page Name as eVar4.

As you suggested, passed eVar4 as an argument also, still no luck.

 

Extension - Custom Editor - 

//s.getPreviousValue(s.pageName,'gpv_pn');
s.prop9 = s.getPreviousValue(s.eVar4,'gpv_pn');
s.linkTrackVars = "prop9";

 

Window Load Rule - 

Also added, but still the same.

@KMahesj, can you able to join below link https://meet.google.com/ofq-nnfd-cbk . so that we can review the implementation & solve this.

Avatar

Level 2

Hi @Charles_Thirupathi,

 

Thanks for your time on call.

As we checked, the implementation part is good, the issue with the domain only.

 

Once will get the Publish instance, then will cross-check again.

Thanks,

Avatar

Level 2

Reviewed in the proper domain host URL, and it's working as expected.

Thanks,

Avatar

Level 1

Hello @KMahesh !

 

I suppose I am facing a similar issue. No cookies are being set for New/Repeat and previous value.

I too have a reason to believe that this is because of the domain. our dev URL is 

https://dev-alb-web-1517290484.ap-south-1.elb.amazonaws.com/ 

 

I wanted to understand more clearly, what does this domain issue mean?

Is it because the configured domain name is different from this or the https invalid certification?

Reason for my curiosity is that, if this is not a domain issue then may be I will be too late to fix it.

Avatar

Level 2

Hi @swetankk,

 

I hope you are doing good.

Domain Issues was like which I had

 

The actual site path was 
https://www.abc.com

and I was validating https://qa.abc.com
and it was not working, when I moved the changes to Production and validated, then it started working.

Thanks,

Mahesh

Avatar

Level 10
Do any of the answers below answer your initial question? If so, can you select one of them as the correct answer? If none of the answers already provided answer your question, can you provide additional information to better help the community solve your question?

Avatar

Level 1

@jantzen_b 

 

Created a rule to initialize the plugin:

user03191_0-1648001798080.png

Created dataelement to store the value with code:

user03191_2-1648001863031.png

 

 

user03191_1-1648001818136.png

Setting variables and sending beacon

 

user03191_3-1648001904262.png

 

When I load the page , I see this in console. The getPreviousValue isn't working or dropping any cookie on the page

 

user03191_4-1648001962678.png

Could you please guide me on this.