This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
use Prezly\Auth\Session\BackendSessionReference; | |
use Prezly\Command\Import\HandleRecord; | |
use Prezly\Task\BaseTask; | |
class importResumeRecordTask extends BaseTask | |
{ | |
protected function configure() | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// /src/handlers/segment/identifyUser.js | |
const { withStatusCode } = require('../../utils/response.util'); | |
const ok = withStatusCode(200, JSON.stringify); | |
const {SegmentTracking} = require('../../SegmentTracking'); | |
const SegmentTracker = new SegmentTracking(); | |
exports.handler = async (event) => { | |
const { id } = event.pathParameters; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//src/handlers/segment/segment.serverless.yml | |
storeEvent: | |
handler: src/handlers/segment/storeEvent.handler | |
events: | |
- http: 'POST /events' | |
identifyUser: | |
handler: src/handlers/segment/identifyUser.handler | |
events: | |
- http: 'GET /segment/identify/user/{id}' | |
trackAnonymous: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
service: ${env:SERVICE_NAME} | |
package: | |
exclude: | |
- data/** | |
- events/** | |
- .idea | |
plugins: | |
- serverless-offline |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// src/SegmentTracking.js | |
const https = require('https'); | |
const dynamoDBFactory = require('./dynamodb.factory'); | |
const {UserToAnonymousModel} = require('./models/UserToAnonymous'); | |
const {SourceAttributionModel} = require('./models/SourceAttribution'); | |
const SOURCE_IDENTIFIED_EVENT_NAME = process.env.ANALYTICS_SOURCE_IDENTIFICATION_EVENT; | |
class SegmentTracking { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"type": "identify", | |
"userId": "[user_id]", | |
"properties": { | |
"source_first_referrer": null, | |
"source_first_referrer_client: "gmail" | |
"source_first_referrer_type": "email", | |
"source_first_campaign_source": "feedburner", | |
"source_first_campaign_medium": "feed", | |
"source_first_campaign_name": "Feed: contrast/blog (The Intercom Blog)", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"referrer": { | |
"type": "email", | |
"client": "gmail", | |
"from": "https://mail.google.com/_/mail-static/_/js/main/m_i,t/rt=h/ver=am293eyFlXI.en./sv=1/am=!v8Czf-oeNMn1FOzaNKsLQrJy-oNN3RSSYMAZTBUxCzwgQcXtLnTEHCkGr437GpFE2Dliuw/d=1", | |
"link": "http://blog.intercom.io/churn-retention-and-reengaging-customers/?utm_source=feedburner&utm_medium=feed&utm_campaign=Feed%3A+contrast%2Fblog+%28The+Intercom+Blog%29" | |
}, | |
"campaign": { | |
"source": "feedburner", | |
"medium": "feed", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
resources: | |
Resources: | |
SegmentIdentifiesDynamoDBTable: | |
Type: 'AWS::DynamoDB::Table' | |
Properties: | |
StreamSpecification: | |
StreamViewType: NEW_IMAGE | |
AttributeDefinitions: | |
- AttributeName: messageId | |
AttributeType: S |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// src/tasks/import_identify_from_file.js | |
// copied from https://stackoverflow.com/questions/32678325/how-can-i-import-bulk-data-from-a-csv-file-into-dynamodb | |
const fs = require('fs'); | |
const parse = require('csv-parse'); | |
const async = require('async'); | |
const CSV_FILENAME = process.argv[2]; | |
const DYNAMODB_TABLENAME = 'sma-identify-event-dev'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// src/tasks/import_page_from_file.js | |
// copied from https://stackoverflow.com/questions/32678325/how-can-i-import-bulk-data-from-a-csv-file-into-dynamodb | |
const fs = require('fs'); | |
const parse = require('csv-parse'); | |
const async = require('async'); | |
const CSV_FILENAME = process.argv[2]; | |
const DYNAMODB_TABLENAME = 'sma-page-event-dev'; |
NewerOlder