Purchase event has happened on Order confirmation page. There is another event, event1 to be fired and counted uniquely for this order. No repeat counting of event1 to happen on page reload. Any one can guide me how to write a code for this same.
You can use event serialization for this. The documentation is outdated in that you can now change those settings within the interface yourself (you need admin access).
Go to
Admin > Report Suites.
Select the rsid(s) and then go to
Edit Settings > Conversion > Success Events
The "Unique Event Recording" column is a dropdown where you can change the setting for the event (default is "Always Record Event"). If you only care about deduping for the visit, then just change it to "Record Once Per Visit" and you're done; Adobe will internally keep it deduped by using the current session id.
If you need to keep it deduped for ever and ever, then change it to "Use Event ID". In addition to this, you will need to update your on-page code to have a serialization id appended to the event in the events string. In principle, this is the same as purchaseID
, except you append the id to the event with a colon delimiter.
For example:
s.events='purchase,event1:12345';
NOTE: Depending on what your purchaseID
value is, you may be able to use that same value for your serialized event. Both are max 20 chars, but serialization IDs can only be alphanumeric, whereas purchaseID
can accept some other chars.
For example:
This will work:
s.events='purchase,event1:foobar'; // valid
s.purchaseID='foobar'; // valid
But this will not (officially according to the docs this won't work. However, unofficially it totally will. I know for a fact based on other implementations that a hyphen is totally allowed, though it's not documented. I also know that it will totally accept more than 20 chars, despite the stated char limit. But be safe and stick w/ the official answers in the doc):
s.events='purchase,event1:foo-bar'; // invalid
s.purchaseID='foo-bar'; // valid
Also note if the event is also part of the products
string (a numeric or currency event), do NOT include the serialization id in the products string.
Example:
// good
s.events='event1:12345';
s.products=';;;;event1=4.50';
// bad
s.events='event1';
s.products=';;;;event1:12345=4.50';
// bad
s.events='event1:12345';
s.products=';;;;event1:12345=4.50';