A/B Testing Installation
To enable the execution of A/B tests, it's essential to identify the article elements on the Home Page by implementing the data-attributes.
Prerequisites
Ensure that you possess the necessary permissions to install plugins on your website. A basic understanding of HTML and JavaScript is also required.
Confirm that you have completed the installation of the Publisher Analytics Plugin.
Installation
Required data-attributes:
data-npaw-article
data-npaw-article-url
If any of the required data-attributes are absent, the article will not be recognized.
Optional data-attributes:
data-npaw-article-title
data-npaw-article-image
data-npaw-article-description
These data-attributes are not obligatory, considering that not all articles contain these elements.
Below is an example demonstrating an article with all its elements correctly identified using the appropriate data-attributes:
<html>
<head>
<title>Here is the title of the page</title>
<!-- Publisher Analytics -->
<script src="https://publisheranalytics.ai/publisher-sdk"></script>
<script>
const accountCode = "demoAccountCode"; // CHANGE HERE
const flickerControl = false; // CHANGE HERE IF YOU WANT
new PublisherAnalyticsSDK(accountCode, flickerControl);
</script>
<!-- /Publisher Analytics -->
</head>
<body>
<div>
<!-- FULL ARTICLE SAMPLE -->
<article data-npaw-article >
<a data-npaw-article-url href="https://breaknews/breakthrough-discovery">
<img data-npaw-article-image src="https://breaknews/assets/image01" alt="alt text for image">
</a>
<a data-npaw-article-url href="https://breaknews/breakthrough-discovery">
<h2 data-npaw-article-title >Breakthrough Discovery: Scientists Unveil New Renewable Energy Source</h2>
<p data-npaw-article-description >Researchers have announced a groundbreaking discovery of
a novel renewable energy source, promising to revolutionize the way we power our
world and significantly reduce our reliance on fossil fuels.
</p>
</a>
</article>
<!-- BASIC ARTICLE SAMPLE -->
<article data-npaw-article >
<a data-npaw-article-url href="https://breaknews/exploring-the-depths">
<h2 data-npaw-article-title >Exploring the Depths: Unraveling the Mysteries of the Ocean's Twilight Zone</h2>
</a>
</article>
</div>
</body>
</html>
Incorporating these identification data-attributes allows for the manipulation of these elements, making it possible to execute automated A/B testing.
Important Details!
- The procedure for identifying articles should be performed on the home page html.
- Be aware that the data-npaw-article-url data-attribute may occur multiple times within each article, as all <a> elements that link to the article's URL should be identified with the data-npaw-article-url data-attribute.
All right! You've completed the A/B Testing installation. Now if you want to use the authors targets feature, the next step is to install the data-attributes to identify the other elements of the articles. See how to do this at Authors Targets Installation.
Support
If you need further assistance, please contact our support team. We're here to help you get the most out of the Publisher Analytics plugin.