DTM - Configure Analytics in DTM - set s.purchaseID?

Avatar

Avatar
Validate 1
Level 2
Frank_Lee_-_UT
Level 2

Likes

2 likes

Total Posts

18 posts

Correct reply

4 solutions
Top badges earned
Validate 1
Boost 1
Affirm 3
Affirm 1
View profile

Avatar
Validate 1
Level 2
Frank_Lee_-_UT
Level 2

Likes

2 likes

Total Posts

18 posts

Correct reply

4 solutions
Top badges earned
Validate 1
Boost 1
Affirm 3
Affirm 1
View profile
Frank_Lee_-_UT
Level 2

15-10-2015

Hi,

I'm in DTM trying to write a Page Load rule that will set s.purchaseID to a javascript variable declared on the Order Confirmation page.  I can find s.campaign, eVars, props, events etc in the Adobe Analytics section of the rule builder, but not s.purchaseID.  Am I looking in the right place?

Thanks!

Accepted Solutions (1)

Accepted Solutions (1)

Avatar

Avatar
Validate 1
Level 2
Frank_Lee_-_UT
Level 2

Likes

2 likes

Total Posts

18 posts

Correct reply

4 solutions
Top badges earned
Validate 1
Boost 1
Affirm 3
Affirm 1
View profile

Avatar
Validate 1
Level 2
Frank_Lee_-_UT
Level 2

Likes

2 likes

Total Posts

18 posts

Correct reply

4 solutions
Top badges earned
Validate 1
Boost 1
Affirm 3
Affirm 1
View profile
Frank_Lee_-_UT
Level 2

15-10-2015

Got a solution from Shawn C. Reed:

In Page Load Rules > Adobe Analytics > Custom Page Code [Open Editor]

I typed the following:

var s=window.s;
s.purchaseID=my_cart_id;

 

s.purchaseID is now firing with the data held in the var 'my_cart_id'

Thanks for the help everyone!

Answers (3)

Answers (3)

Avatar

Avatar
Validate 1
Level 2
Frank_Lee_-_UT
Level 2

Likes

2 likes

Total Posts

18 posts

Correct reply

4 solutions
Top badges earned
Validate 1
Boost 1
Affirm 3
Affirm 1
View profile

Avatar
Validate 1
Level 2
Frank_Lee_-_UT
Level 2

Likes

2 likes

Total Posts

18 posts

Correct reply

4 solutions
Top badges earned
Validate 1
Boost 1
Affirm 3
Affirm 1
View profile
Frank_Lee_-_UT
Level 2

15-10-2015

Hi Erika,

Does it matter if I enter in the custom script via the Adobe Analytics section vs the Javascript section?

Other ideas I've heard involve writing the custom script prefaced with var s=window.s;

ex:

var s=window.s;
s.purchaseID=my_cart_id;

I've made a Data Element from the js variable on the page and named it my_cart_id.  Tried a custom script as:

s.purchaseID = _satellite.getVar('my_cart_id');

Does that look right, or should it be:

s.purchaseID = _satellite.getVar('%my_cart_id%');

?

Thanks!

Avatar

Avatar
Validate 1
Employee
Erika_Barber
Employee

Likes

16 likes

Total Posts

63 posts

Correct reply

17 solutions
Top badges earned
Validate 1
Give Back
Boost 5
Boost 3
Boost 10
View profile

Avatar
Validate 1
Employee
Erika_Barber
Employee

Likes

16 likes

Total Posts

63 posts

Correct reply

17 solutions
Top badges earned
Validate 1
Give Back
Boost 5
Boost 3
Boost 10
View profile
Erika_Barber
Employee

15-10-2015

Hard to say for sure without looking at your code, but you'll probably want to set up that JavaScript variable as a Data Element in DTM.  JS Object is a built-in option, so you can simply enter the path for that variable. 

Once that is saved, you can reference the Data Element in custom script (you were entering it in the right place).  For example:

s.purchaseID = _satellite.getVar('name of your data element');

Right after that custom code, you may also want to use _satellite.notify('custom script fired', 1); or something like that for debugging purposes.  _satellite.notify() is a protected version of console.log().  You can look in the console and make sure that script fired as expected.

Hope that helps.  Let us know if that doesn't work for you.

Avatar

Avatar
Validate 1
Level 2
Frank_Lee_-_UT
Level 2

Likes

2 likes

Total Posts

18 posts

Correct reply

4 solutions
Top badges earned
Validate 1
Boost 1
Affirm 3
Affirm 1
View profile

Avatar
Validate 1
Level 2
Frank_Lee_-_UT
Level 2

Likes

2 likes

Total Posts

18 posts

Correct reply

4 solutions
Top badges earned
Validate 1
Boost 1
Affirm 3
Affirm 1
View profile
Frank_Lee_-_UT
Level 2

15-10-2015

Alternately, I've tried writing some custom scripts, but I can't seem to get any to fire.

I'm in Page Load Rule > Adobe Analytics > Custom Page Code [Open Editor] >

s.purchaseID=<javascript variable>;

e.g.

s.purchaseID=my_order_ID;

 

Am I missing anything?

Thanks!