Edit your Smartserve prescript
Edit your Smartserve prescript
This is for:
DeveloperIn this article, we’ll show you how you can use your prescript to run some JavaScript before any data collection or experience activation begins.
What is the prescript
The Smartserve prescript can be used to run some JavaScript before any data collection or experience activation begins.
It allows you to implement a wide range of bespoke use cases, tailored to your specific requirements. Examples include:
-
Tracking experience shown events in your third party analytics solution
-
Preventing Smartserve from firing based on specific conditions (for example, a cookie value or URL parameter)
-
Synchronizing Qubit segment membership changes to a third party
-
Setting up a QProtocol data layer mapper
Leading-practice
You can also manage your script through the Qubit CLI. |
Open the prescript
Select Settings from the side menu and then Edit in the Prescript* card.
Edit the prescript
Make sure that you’ve selected prescript.js from the side menu:
Make the required changes and select Save You can now return to the previous page by selecting X in the upper-right hand corner
Leading-practice
For some examples of how the prescript can be used, see Code examples. |
Note
To publish your changes, you’ll need to review and apply them. |
Review and publish your changes
When you or a member of your team has made changes to the prescript, those changes need to be reviewed and applied before they can be published. We’ll notify you when there are changes ready for review.
In the following example, we see that there are unpublished changes and that the changes were made on October 17:
To review those changes, select Review and apply changes
So you can see what has been changed, we display a diff. In the following example, we see that a change was made on line 10:
Enter a reason for the change. Be as descriptive as possible to help other team members understand why the change was made
Select Publish
View a changelog
So you and your team can keep track of changes to the prescript, we provide a revision history that you can browse through.
To view the changelog, select Revision history. In the following example, we see that there have been 4 revisions:
You can now select a revision to see the changes in a diff and the reason. Select Previous revision and Next revision to cycle through the changes. To return to the revision history, select Revision history