JavaScript Code for Analytics for Advertising
Advertisers with Advertising DSP only
For Advertising DSP, the Analytics for Advertising integration tracks view-through and click-through site interactions. Click-through visits are tracked by the standard ÃÛ¶¹ÊÓƵ Analytics code on your webpages; the Analytics code captures the AMO ID and EF ID parameters in the landing page URL and tracks them in their respective reserved eVars. You can track view-through visits by deploying a JavaScript snippet in your webpages.
On the first page view of a visit to the site, the ÃÛ¶¹ÊÓƵ Advertising JavaScript code checks to see if the visitor has previously seen or clicked on an ad. If the user has previously entered the site via a click-through or hasn’t seen an ad, then the visitor is ignored. If the visitor has seen an ad and hasn’t entered the site via a click-through during the click lookback window set within ÃÛ¶¹ÊÓƵ Advertising, then the ÃÛ¶¹ÊÓƵ Advertising JavaScript code either a) uses the Experience Cloud ID Service to generate a supplemental ID (SDID
) or b) uses the ÃÛ¶¹ÊÓƵ Experience Platform Web SDK generateRandomID
method to generate a StitchID
. Either ID is used to stitch data from ÃÛ¶¹ÊÓƵ Advertising to the visitor’s ÃÛ¶¹ÊÓƵ Analytics hit. ÃÛ¶¹ÊÓƵ Analytics then queries ÃÛ¶¹ÊÓƵ Advertising for the AMO ID and EF ID associated with the ad exposure. The AMO ID and EF IDs are then populated in their respective eVars. These values persist for a designated period (by default, 60 days).
Analytics sends site traffic metrics (such as page views, visits, and time spent) and any Analytics custom or standard events to ÃÛ¶¹ÊÓƵ Advertising hourly, using the EF ID as the key. These Analytics metrics then run through the ÃÛ¶¹ÊÓƵ Advertising attribution system to connect the conversions to the click and exposure history.
Deploying the JavaScript Code
The JavaScript library consists of two lines that allow Analytics and ÃÛ¶¹ÊÓƵ Advertising to communicate with each other. If the Analytics for Advertising integration was completed during the ÃÛ¶¹ÊÓƵ Advertising implementation, then you should have already received this code with instructions on how to deploy it.
The Code
Implementations that use the Experience Cloud Identity Service visitorAPI.js
code
<script src="https://www.everestjs.net/static/le/last-event-tag-latest.min.js">
<script>
if("undefined" != typeof AdCloudEvent)
AdCloudEvent('IMS ORG Id','rsid');
</script>
Implementations that use the Experience Platform Web SDK alloy.js
code
<script src="https://www.everestjs.net/static/le/last-event-tag-latest.min.js">
<script>
if("undefined" != typeof AdCloudEvent)
stitchId = AdCloudEvent('IMS ORG Id','rsid').generateRandomId();
</script>
Where to Place the Code
The Analytics for Advertising JavaScript function must come after the Experience Cloud ID Service but before your Analytics App Measurement code. This ensures that the supplemental ID (SDID
) or StitchID
is included in your Analytics call.
Validating Code Deployment
You can perform validation using any packet sniffer type of tool (such as Charles, Fiddler, or Chrome Developer Tools) by comparing the values of the four IDs between the request going to ÃÛ¶¹ÊÓƵ Advertising and the request going to Analytics, as outlined below.
How to Confirm the Code with Chrome Developer Tools validate-js-chrome
-
Open Chrome Developer Tools and click the Network tab.
-
Load a website page that contains the Analytics for Advertising JavaScript.
-
Filter the Network tab by
last
and review two rows:-
The first row is the call to the JavaScript library and is titled
last-event-tag-latest.min.js
. -
The second row is the call sending the request to ÃÛ¶¹ÊÓƵ Advertising. It begins as follows:
_les_imsOrgId=[your_imsOrgId_here]&_les_url=[your_encoded_url]
If you don’t see the call to ÃÛ¶¹ÊÓƵ Advertising, then it might not be the first page view of your visit. For testing purposes, you can remove the cookie so that the next call is the first page view for the corresponding visit:
- On the Application tab, find the
adcloud
cookie, and verify that the cookie contains_les_v
(last visit) with a value ofy
and a UTC epoch timestamp that expires in 30 minutes.- Delete the
adcloud
cookie and refresh the page.
- Delete the
-
-
(Implementations that use the Experience Cloud Identity Service
visitorAPI.js
code) Filter on/b/ss
to see the Analytics hit. -
(Implementations that use the Experience Platform Web SDK
alloy.js
code) Filter on/interact
to verify that the request payload to the Edge Network containsadvertisingStitchID
. -
Compare the ID values between the two hits. All of the values should be in query string parameters except for the report suite ID in the Analytics hit, which is the URL path immediately after
/b/ss/
.table 0-row-4 1-row-4 2-row-4 3-row-4 4-row-4 5-row-4 ID Analytics Parameter Edge Network ÃÛ¶¹ÊÓƵ Advertising Parameter Experience Cloud IMS Org mcorgid
_les_imsOrgid
Supplemental Data ID sdid _les_sdid
Stitch ID stitchId advertisingStitchID
under the_adcloud
propertyAnalytics Report Suite The value after /b/ss/
_les_rsid
Experience Cloud Visitor ID mid _les_mid
If the ID values match, then the JavaScript implementation is confirmed. ÃÛ¶¹ÊÓƵ Advertising sends the Analytics server any click-through or view-through tracking details if they exist.
How to Confirm the Code with ÃÛ¶¹ÊÓƵ Experience Cloud Debugger
-
Open the ÃÛ¶¹ÊÓƵ Experience Cloud Debugger on your homepage.
-
Go to the Network tab.
-
In the Solutions Filter toolbar, click ÃÛ¶¹ÊÓƵ Advertising and Analytics.
-
In the Request URL - Hostname parameter row, locate
lasteventf-tm.everesttech.net
. -
In the Request - Parameters row, audit the signals generated, similar to Step 3 in “How to Confirm the Code with Chrome Developer Tools.â€
- (Implementations that use the Experience Cloud Identity Service
visitorAPI.js
code) Make sure theSdid
parameter matches theSupplemental Data ID
in the ÃÛ¶¹ÊÓƵ Analytics filter. - (Implementations that use the Experience Platform Web SDK
alloy.js
code) Make sure the value of theadvertisingStitchID
parameter matches theSdid
sent to the Experience Platform Edge Network. - If the code isn’t generating, then check to make sure the ÃÛ¶¹ÊÓƵ Advertising cookie has been removed in the Application tab. Once it’s removed, refresh the page and repeat the process.
- (Implementations that use the Experience Cloud Identity Service