Browser SDK usage
Once the SDK is installed you can start working with the client.
Configuring
View the config reference for a full list of configuration options.
import {
ConvergeSdk,
TrackingActivityNames,
ConvergeSdkLogEventLevel,
} from "@seeka-labs/converge";
import { BotDetectionConvergeSdkPlugin } from "@seeka-labs/converge-plugin-botdetection";
import { FacebookPixelConvergeSdkPlugin } from "@seeka-labs/converge-plugin-facebook-pixel";
import { SnapchatPixelConvergeSdkPlugin } from "@seeka-labs/converge-plugin-snapchat-pixel";
import { PinterestTagConvergeSdkPlugin } from "@seeka-labs/converge-plugin-pinterest-tag";
import { TikTokPixelConvergeSdkPlugin } from "@seeka-labs/converge-plugin-tiktok-pixel";
import { SeekaConvergeSdkPlugin } from "@seeka-labs/converge-plugin-seeka";
const converge = new ConvergeSdk({
key: "(public key)",
organisationId: "(Organisation ID)",
debug: {
isEnabled: true,
minimumLevel: ConvergeSdkLogEventLevel.Verbose,
},
tracking: {
analytics: {
autoCollection: {
activityNames: [
TrackingActivityNames.ViewPage,
TrackingActivityNames.ViewProduct,
],
},
},
defaults: { currencyCode: "USD" },
},
plugins: [
new BotDetectionConvergeSdkPlugin({}),
new FacebookPixelConvergeSdkPlugin({ pixelId: "(Facebook pixel ID)" }),
new SnapchatPixelConvergeSdkPlugin({ pixelId: "(Snapchat pixel ID)" }),
new PinterestTagConvergeSdkPlugin({ tagId: "(Pinterest tag ID)" }),
new TikTokPixelConvergeSdkPlugin({ pixelId: "(TikTok pixel ID)" }),
new SeekaConvergeSdkPlugin(),
],
});
Interacting
View the method reference for a full list of methods.
Retrieving the person ID
The SeekaPId
(Seeka profile ID / Seeka person ID) is available very early in the browser SDK lifecycle and can be retrieved in either of the following ways:
Via event listener
<script>
window.addEventListener("converge.identity.changed", function (ev) {
if(ev.detail.identifiers.seekaPId) {
console.log("Seeka person ID", ev.detail.identifiers.seekaPId);
}
});
</script>
Via identity SDK property
// After the SDK is ready, below can be called
console.log("Seeka person ID", Converge.identity.personId)
Cross domain tracking
This is very important for widget or iframe based integrations that are placed on customer websites or iframes that do not match the opener origin hostname.
For marketing strategies that carry across multiple domains, Seeka provides a browser SDK method that powers cross domain tracking.
This feature can be configured in the Seeka app by users or can be interacted with by developers via code by following the guides below.
Adding to a URL
Use this method to add cross domain tracking to a single link.
var nonCrossDomainTrackingUrl = 'https://my.subdomain.com/product/supercool';
var crossDomainTrackingUrl = Converge.attribution.addCrossDomainTracking(nonCrossDomainTrackingUrl);
window.open(crossDomainTrackingUrl);
Adding to an Iframe
Use this method to ensure cross domain tracking and attribution between iframes that do not share the same hostname/domain.
var nonCrossDomainTrackingUrl = 'https://book.ticketsoftware.com/widget/event/super-awesome-fest';
var crossDomainTrackingUrl = Converge.attribution.addCrossDomainTracking(nonCrossDomainTrackingUrl);
var iframe = document.getElementById('bookingwidgetframe');
iframe.src = crossDomainTrackingUrl;