Client Side SDK

Conversion

Overview

This guide provides details on how to implement conversion tracking using the ViralLoops SDK. The conversion tracking method is essential for recording successful actions or milestones achieved by participants within your campaign.

Preparation

Before implementing conversion tracking, ensure that the ViralLoops SDK is loaded on the page where you are attempting to track conversions. Follow the instructions provided in Setting up your site to include and initialize the SDK in your project.

Scenario 1: Participant Identified on a Previous Stage/Page

If the participant has already been identified in a previous stage or page and the confirmation page is still under the same domain, you can use the following method to track the conversion:

ViralLoops.getCampaign().then(campaign => campaign.track("conversion"));

or using async/await

const campaign = await ViralLoops.getCampaign();
await campaign.track("conversion");

Scenario 2: Participant Not Identified

ViralLoops.getCampaign().then(campaign => campaign.track("conversion", {email: "<PARTICIPANT_EMAIL>"}));

or using async/await

const campaign = await ViralLoops.getCampaign();
await campaign.track("conversion", {
	email: "<PARTICIPANT_EMAIL>"
});

Replace <PARTICIPANT_EMAIL> with the actual email address of the participant.


What’s Next

Checkout the Participant Conversion guide for more insights on how the conversion endpoint works and how to convert participants from your server-side implementation.