Skip to content

Commit a4218f1

Browse files
GrowthCode Analytics: Updates/BugFixes (prebid#10339)
* Update Markdown for growthCodeAnalytics modules * GC-85 Update URL endpoint in growthCodeAnalytics module * GC-84 added an addition event to send to server * GC-83 Added the passage of the GCID in the POST * Update growthCodeAnalytics module tests * Fixed event bug * Removed package-lock.json
1 parent 1678443 commit a4218f1

File tree

4 files changed

+11
-24
lines changed

4 files changed

+11
-24
lines changed

integrationExamples/gpt/growthcode.html

+3-12
Original file line numberDiff line numberDiff line change
@@ -56,20 +56,11 @@
5656
provider: 'growthCodeAnalytics',
5757
options: {
5858
pid: 'TEST01',
59+
//url: 'http://localhost:8080/v3/pb/analytics',
5960
trackEvents: [
60-
'auctionInit',
6161
'auctionEnd',
62-
'bidAdjustment',
63-
'bidTimeout',
64-
'bidTimeout',
65-
'bidRequested',
66-
'bidResponse',
67-
'setTargeting',
68-
'requestBids',
69-
'addAdUnits',
70-
'noBid',
7162
'bidWon',
72-
'bidderDone']
63+
]
7364
}
7465
});
7566
pbjs.setConfig({
@@ -80,7 +71,7 @@
8071
auctionDelay: 1000,
8172
dataProviders: [{
8273
name: 'growthCodeRtd',
83-
waitForIt: true,
74+
waitForIt: false,
8475
params: {
8576
pid: 'TEST01',
8677
}

modules/growthCodeAnalyticsAdapter.js

+7-4
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import {MODULE_TYPE_ANALYTICS} from '../src/activities/modules.js';
1313

1414
const MODULE_NAME = 'growthCodeAnalytics';
1515
const DEFAULT_PID = 'INVALID_PID'
16-
const ENDPOINT_URL = 'https://p2.gcprivacy.com/v1/pb/analytics'
16+
const ENDPOINT_URL = 'https://p2.gcprivacy.com/v3/pb/analytics'
1717

1818
export const storage = getStorageManager({moduleType: MODULE_TYPE_ANALYTICS, moduleName: MODULE_NAME});
1919

@@ -138,12 +138,15 @@ growthCodeAnalyticsAdapter.enableAnalytics = function(conf = {}) {
138138

139139
function logToServer() {
140140
if (pid === DEFAULT_PID) return;
141-
if (eventQueue.length > 1) {
141+
if (eventQueue.length >= 1) {
142+
// Get the correct GCID
143+
let gcid = localStorage.getItem('gcid')
144+
142145
let data = {
143146
session: sessionId,
144147
pid: pid,
148+
gcid: gcid,
145149
timestamp: Date.now(),
146-
timezoneoffset: new Date().getTimezoneOffset(),
147150
url: getRefererInfo().page,
148151
referer: document.referrer,
149152
events: eventQueue
@@ -167,7 +170,7 @@ function sendEvent(event) {
167170
eventQueue.push(event);
168171
logInfo(MODULE_NAME + 'Analytics Event: ' + event);
169172

170-
if (event.eventType === CONSTANTS.EVENTS.AUCTION_END) {
173+
if ((event.eventType === CONSTANTS.EVENTS.AUCTION_END) || (event.eventType === CONSTANTS.EVENTS.BID_WON)) {
171174
logToServer();
172175
}
173176
}

modules/growthCodeAnalyticsAdapter.md

+1-7
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,7 @@ pbjs.enableAnalytics({
2121
pid: '<Contact GrowthCode>',
2222
trackEvents: [
2323
'auctionEnd',
24-
'bidAdjustment',
25-
'bidTimeout',
26-
'bidRequested',
27-
'bidResponse',
28-
'noBid',
29-
'bidWon',
30-
'bidderDone']
24+
'bidWon']
3125
}
3226
});
3327
```

test/spec/modules/growthCodeAnalyticsAdapter_spec.js

-1
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,6 @@ describe('growthCode analytics adapter', () => {
6464
var eventTypes = [];
6565
body.events.forEach(e => eventTypes.push(e.eventType));
6666
assert(eventTypes.length > 0)
67-
assert(eventTypes.indexOf(constants.EVENTS.AUCTION_END) > -1);
6867
growthCodeAnalyticsAdapter.disableAnalytics();
6968
});
7069
});

0 commit comments

Comments
 (0)