Collect event data

Prepr is a data-driven CMS, meaning you can capture events, store and process big data. With this, we enable you to segment your customers and personalize content for them.

Every event is associated with an event type; the time it happened, the customer that caused the event, and optionally some metadata. Events can be created using the Prepr Tracking Code or the REST API.

Event types

Event types are specifying the kind of event the customer has with your content. For example when a customer views a post a View event is recorded.

Constraint events can only be created once in a Customer-Content relationship.

Type
View
Like
Dislike
Comment
Bookmark
Subscribe
Purchase
Vote
Clickthrough
Share
SignUp
Unlike
Unbookmark
Unsubscribe
Unvote

'Un*' events like: 'Unlike', 'Unbookmark' and 'Unsubscribe' will delete the Customer-Content relationship.

Recording events using the Tracking Code

Adding the Tracking Code

Prepr uses a lightweight piece of javascript to capture events: the Prepr tracking code.

  1. Go to Settings > Tracking code.
  2. Click Copy code to get a ready-to-use Prepr tracking code and add it to the <head> section of your website.

tracking-code

If you don't have a tracking code in your environment settings, click here to learn how to create it manually.

Once you've added the tracking code, proceed with recording events.

Recording events

To start tracking events on content items, add the following meta property or name tag to the <head> on all content pages. Replace the content of the tag with the content ID. If the prepr:id property or name is present, a View event will be recorded on page load.

<!-- property tag -->
<meta property="prepr:id" content="16c63a1e-e837-4951-bd9a-b933a8d14b2f"/>

<!-- or name tag -->
<meta name="prepr:id" content="16c63a1e-e837-4951-bd9a-b933a8d14b2f"/>

To associate an event with an existing customer, an optional meta property or name tag can be added to the page. If your site uses an identity provider you can use that customer ID to track events on.

<!-- property tag -->
<meta property="prepr:customer-id" content="16c63a1e-e837-4951-bd9a-b933a8d14b2f"/>

<!-- or name tag -->
<meta name="prepr:customer-id" content="16c63a1e-e837-4951-bd9a-b933a8d14b2f"/>

If the customer ID is not found in your customers list when the event gets processed, a new customer will be created. By default, a cookie with a unique ID will be used.

Recording other events

To record events you need to have the Prepr Tracking Code set up. Once added, you can submit an event using the event method. Optional metadata can be sent with the event.

In the example below we send a Like event for a published post:

prepr('event', 'Like');

If you have multiple content items on the same page, you can send the content item ID within the event.

prepr('event', 'Subscribe', { 'id': "16c63a1e-e837-4951-bd9a-b933a8d14b2f" });

If you need to tag a user when they fill specific values in a form on your page, for example, to segment customers based on an entered value, then you can send an event request to set a Tag on the user profile as follows:

prepr('event', 'Tag', ["healthcareworker"]);  

Specifying constraints

Prepr can help to enforce data integrity with the use of constraints. Constraints can be applied to supported event and will guarantee both existence and uniqueness. An event that violates the constraint will be discarded.

The following event types support constraints:

Type
View
Like
Dislike
Comment
Bookmark
Subscribe
Purchase
Vote
Clickthrough
Share
SignUp
prepr('event', 'Vote', { 'constraint': true });

Search Bots and Prepr

Bots are automated computer programs that click around in a browser, attempting to mimic humans.

Bots can either run on servers in a datacenter such as Amazon Web Services, or sometimes, on people’s personal computers that have been infected with malware or a virus (referred to as a botnet).

Some bots, such as GoogleBot, are used for legitimate purposes such as indexing the web. For more information on how Prepr handles search bots, click here.

Recording events using the REST API

With the REST API you can send event data to Prepr. This can be convenient for offline conversions or if you're working in a restricted environment and aren't allowed to load third-party Javascript snippets.

JSON Structure

The table below shows the fields that are supported in the REST API.

argumenttyperequireddescription
labelStringYesDefines the event type.
timestampUTC Timest.Event timestamp (default time of request).
constraintBooleanEnforce constraint.
Content Item Data
content_itemArrayYes
content_item.idStringYesContent item ID the event is recorded for.
content_item.localeStringLocale like en-GB.
Customer Data
customerArrayYes
customer.idStringID of Prepr User
Metadata
utm_mediumStringCampaign Medium
utm_sourceStringCampaign Source
utm_campaignStringCampaign Name
utm_termStringCampaign Term
utm_contentStringCampaign Content
rlStringReferrer location, example: https://prepr.io/
srStringScreen resolution, example: 1680x1050

You need to supply a customer ID for the event to be recorded.

If the customer ID is not found in your customers list when the event gets processed, a new customer will be created.

Recording events

If you collected all the data, the JSON data object should be posted to the following endpoint:

POST https://tracking.prepr.io/events

{
    "label" : "View",
    "timestamp" : 1609588800, // Optional
    "content_item" : {
        "id" : "76a5e261-ec2a-4bd2-8195-cf7e889b0a68"
    },
    "customer" : {
        "id" : "x-21381723243-PRP"
    }
}

This endpoint requires an HTTP Authorization header with an Access Token containing the capture_publish scope.

If the event was successful queued the endpoint will return a status code 202 Accepted.

The endpoint won't validate the input. Processing of the events are queued. Errors are logged in the access token request logs.

To validate your input, within a few seconds, you'll see the data reflected in the Prepr Engagement page.

Specifying constraints

Prepr can help to enforce data integrity with the use of constraints. Constraints can be applied to supported event and will guarantee both existence and uniqueness. An event that violates the constraint will be discarded.

The following event types support constraints:

Type
View
Like
Dislike
Comment
Bookmark
Subscribe
Purchase
Vote
Clickthrough
Share
SignUp

Capturing event data and Search Bots

What are Bots?

A search bot, sometimes called a spider, is a robot that continuously browses the internet, usually for the purpose of building a search index or archiving websites.

Bots can artificially inflate event data, so it’s important to be aware of their existence.

Prepr and Search Bots

Prepr can detect search bots that deliberately reveal themselves. All traffic from known bots and spiders is automatically excluded. This ensures that your Prepr data, to the extent possible, does not include events from known bots. At this time, you cannot disable known bot data exclusion or see how much known bot data was excluded.

Known bot traffic is identified using a combination of our research and the International Spiders and Bots List.

List of excluded bots

Below is a list of search bots and their user-agents that Prepr identifies.

user AgentSearch Bot
200pleasebot200PleaseBot
360spider360Spider
abotCrawlDaddy, abot
addthisAddThis
adldxbotMicrosoft Bing Ads
admantxADmantX Platform Semantic Analyzer
adsbot-googleGoogle Adwords
advbotAdvBot
ahrefsbotAhrefs backlinks research tool
alexaAlexa Crawler
apache-httpclientJava http library
apachebenchApacheBench (ab)
apis-googleAPIs-Google
appengine-googleGoogle App Engine
applebotApple Bot
archive.org_botInternet Archive (archive.org)
ask jeevesAsk Jeeves
asynchttpclientJava http and WebSocket client library
awe.smAwe.sm URL expander
baiduBaidu
bdcbotBig Data Corp
bingbotMicrosoft Bing
bingpreviewMicrosoft Bing preview
bitlybotbit.ly bot
blekkobotBlekkobot
blexbotBLEXBot (webmeup)
bot@linkfluence.netLinkfluence bot
bufferbotBufferBot
buibui-checkbotbuibui
butterflyTopsy Labs
buzztalkbuzztalk
catchbotCatchBot (catchbot.com)
check_httpNagios monitor
cliqzbotCliqzbot
cmradar/0.1CMRadar/0.1
coldfusionColdFusion http library
commoncrawlCCBot
comodo-webinspector-crawlerComodo
crowsnestCrowsnest
curabotcura.yt
curlcurl unix CLI http client
dap/nethttpDAP/NetHTTP
datagnionbotdatagnion.com/bot.html
daumoaKorean portal and search engine indexing bot
developers.google.com/+/web/snippetGoogle Plus
diffbotDiffbot
digitalpersona fingerprint softwareHP Fingerprint scanner
domain re-animator botDomain Re-Animator Bot
domainsbotDomainsBot
domaintunocrawlerDomainTuno
dotbotDot Bot
duckduckDuck Duck Go
elb-healthcheckerAWS ELB HealthChecker
embedlyEmbedly
eoaagentEOAAgent
eventmachine httpclientRuby http library
everyonesocialbotEveryoneSocial
evrinidEvri bot
exabotExalead's bot
exaleadcloudviewExaleadCloudView
facebookexternalhitFacebook Bot
facebotFacebook Bot
feedburnerRSS bot
feedfetcher-googleGoogle Feedfetcher
findxbotFindxbot
flipboardproxyFlipboardProxy
friendfeedbotFriendFeed
genieoGenieo Web filter bot
getprismatic.comgetprismatic.com
gigabotGigabot spider
gimme60botGimme60 (gimme60.com)
gimmeusabotGimme60 (gimme60.com)
go http packageGo http library
google page speed insightsGoogle Page Speed Insights
google Web PreviewGoogle Instant Previews crawler
google-structured-data-testing-toolGoogle-StructuredDataTestingTool
google-structureddatatestingtoolGoogle-StructuredDataTestingTool
googlebotGoogle Bot
googlestackdrivermonitoring-uptimechecksGoogleStackdriverMonitoring-UptimeChecks
grapeshotcrawlerGrapeshotCrawler
gravitybotGravity Bot
hatena::bookmarkHatena::Bookmark
heritrixheritrix
htmlparserHTMLParser
http_request2HTTP_Request2
httpclientHTTPClient
https://developers.google.com/+/web/snippetGoogle+ Snippet Fetcher
hubspotHubSpot
ia_archiverInternet Archive (WayBackMachine)
icoreserviceiCoreService
idmarchidmarch.org/bot.html
inagistURL resolver
insieveInsieve Bot
insitesbotInsitesbot
instapaperInstapaper
istellabotIstellaBot
jackjack
jakarta commonsJakarta Commons HttpClient
javaGeneric Java http library
jetslideJetslide
js-kitURL resolver
kemvibotKemvi
kimengiKimengi Bot
knows.isknows.is
kojitsubotKojitsubot
komodiabotKomodiaBot
krakenkraken
laconicaLaconica
libwww-perlPerl client-server library
lijit crawlerLijit
linkdexbotLinkdex Bot
linkedinbotLinkedIn
linkscrawlerLinksCrawler
linodeLinode Longview
lipperheyLipperhey
livelapbotLivelapbot
loadtimebotLoad Time Bot
longurlURL expander service
ltx71ltx71.com
lumibotLumibot
lwp-trivialAnother Perl library
magpie-crawlermagpie-crawler
mail.ru_botMail.ru Bot
meanpathbotmeanpath
mediapartners-googleGoogle Adsense bot
megaindex.ruMegaIndex
memorybotmignify.com/bot.html
metauriMetaURI
mfe_expandMcafee spider
mir web crawlerMIR web crawler
mj12botMajestic-12 spider
mojeekbotMojeek UK search crawler
mrchromeMrChrome
ms search 6.0 robotMS Search 6.0 Robot
msnbot-mediaMicrosoft media bot
msnbotMicrosoft bot
nerdybotNerdyBot
netcraftNetcraft
netstatenetEstate NE Crawler
netvibesPersonalized dashboard bot
netzcheckbotnetzcheck
newrelicmonitorNewRelic monitor
newrelicpingerNewRelicPinger
newsmenewsme
niki-botniki-bot
ningNING
nutchApache search spider
openhosebotOpenHoseBot
orangebotOrangeBot
pagesinventorypagesinventory.com
panoptaMonitoring service
paperlibotPaperLi
peerindexpeerindex
percolatecrawlerPercolateCrawler
perfectmarketkwtbotPerfectMarket
phantomjsPhantomJS
pingdomPingdom monitoring
pinterestPinterest
plukkiebotje.com/plukkie.htm
privacyawarebotPrivacyAwareBot
proximicProximic Spider
psbot-pagePicsearch
publiclibraryarchive.orgpubliclibraryarchive.org
pycurlPython http library
python-httplib2Python-httplib2
python-requestsPython http library
python-urllibPython http library
queryseekerQuerySeekerSpider
quicklookQuickLook
re-animatorDomain Re-Animator Bot
readabilityReadability
rebelmouseRebelMouse
redditbotReddit Bot
relateiqRelateIQ
riddlerRiddler Bot
rogerbotSeoMoz spider
rssmicroRSS/Atom Feed Robot (rssmicro.com)
rubyRuby
scrapyScrapy
screaming frog seo spiderScreaming Frog SEO Spider
searchmetricsbotSearchmetricsBot
semrushbotSEO analysis bot
seokicksSEOKicks
seznambotSeznamBot
shopwikiShopWiki
shortlinktranslateLink shortener
showyoubotShowyou iOS app spider
siegeJoe Dog Siege
sistrixSISTRIX
siteuptimeSite monitoring services
slackSlackbot-LinkExpanding
slackbotSlack Bot
slurpYahoo spider
smtbotSimilarTech
socialrankSocialRankIOBot
sogouChinese search engine
spbotOpenLinkProfiler
spidergeneric web spider
spinn3rSpinn3r aggregator
sputnikbotSputnikBot
squiderSquider
statuscakeStatusCake
stripeStripe
test certificate infoC http library?
tineyeTinEye Bot
traackrTraackr Bot
trendictionbotTrendiction Search
turnitinbotTurnitinBot
tweetedtimesThe Tweeted Times
tweetmemebotTweetMeMe Crawler
twikleSocial web search bot
twitjobsearchTwitJobSearch
twitmuninTwitmunin
twitterbotTwitter URL expander
twurlyTwurly
typhoeusTyphoeus
umbotuberMetrics
unwindfetchGnip
uptimerobotUptime Robot
vagabondoVagabondo
vb projectVisual Basic
vigilVigil
vkshareVKontake Sharer
voilabotVoilaBot
vrcrawlerVenture Radar
wasalive-botWasalive Bots
watchsumoWatchSumo
wbsearchbotWare Bay Best Buys
webscoutWebscout
weseeWeSEE
wgetwget unix CLI http client
wordpressWordPress spider
wormlyWormlyBot
wotboxWotbox
xenu link sleuthXenu Link Sleuth
xing-contenttabreceiverXing bot
xovibotXoviBot
yacybotYaCy
yahoo-ad-monitoringYahoo Ad monitoring
yandexYandex
yetiNaver Corp
yourlsYOURLS
zelist.rofeed parser
zibbZIBB spider
zitebotZite
zyborgZyborg