Forcing Collection
One of the criteria of implementations can be the need to be able to collect particular sessions that may fall outside of the standard sampling method. This can be achieved by making use of the DXA setCollectionJavaScript endpoint, which will ensure that if a users' session is not in the sample, and therefore not being collected, it will begin to be collected from the point of calling the endpoint.
Arguments
- status (boolean) — New collection status for the current session
- remember (boolean|integer) — Whether to remember the collection status for the next session (optional). If true is provided, the status will apply for this and all future sessions. If false is provided, the status will apply for this session only. If an integer value is provided, the status will apply to this session and any future sessions within the provided number of seconds. If not provided, this will default to true.
Testing
In order to test if triggering setCollection has been successful, you can do this by using the DXA Google Chrome extension. Ensure you have Logging enabled and are logged into the DXA platform within the same browser session that you're testing.
Upon triggering the setCollection in testing, you will see a DXA log printed to the console, such as in the second line of the below image: