Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions examples/plugins/page-view-tracking-enrichment/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { createInstance } from '@amplitude/analytics-browser';
import { EnrichmentPlugin } from '@amplitude/analytics-types';
import { EnrichmentPlugin } from '@amplitude/analytics-core';

/**
* This is an example plugin that enriches events with event_type "Page View" by adding
Expand All @@ -13,7 +13,8 @@ export const pageViewTrackingEnrichment = (): EnrichmentPlugin => {
type: 'enrichment',
setup: async () => undefined,
execute: async (event) => {
if (event.event_type !== '[Amplitude] Page Viewed') { // event name format if using Autocapture Pageviews
if (event.event_type !== '[Amplitude] Page Viewed') {
// event name format if using Autocapture Pageviews
return event;
}
event.event_properties = {
Expand Down
3 changes: 1 addition & 2 deletions examples/plugins/remove-event-key/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { createInstance } from '@amplitude/analytics-browser';
import { EnrichmentPlugin } from '@amplitude/analytics-types';
import { BaseEvent } from '@amplitude/analytics-types/src';
import { EnrichmentPlugin, BaseEvent } from '@amplitude/analytics-core';

type KeyOfEvent = keyof BaseEvent;

Expand Down
3 changes: 1 addition & 2 deletions packages/analytics-browser-test/test/helpers.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
/* eslint-disable @typescript-eslint/no-unsafe-call */
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
import { BaseEvent, Campaign } from '@amplitude/analytics-types';
import { BASE_CAMPAIGN } from '@amplitude/analytics-client-common';
import { BaseEvent, Campaign, BASE_CAMPAIGN } from '@amplitude/analytics-core';
import { uuidPattern } from './constants';

const uuid: string = expect.stringMatching(uuidPattern) as string;
Expand Down
3 changes: 1 addition & 2 deletions packages/analytics-browser-test/test/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@ import { default as nock } from 'nock';
import { success } from './responses';
import 'isomorphic-fetch';
import { path, url, SUCCESS_MESSAGE, uuidPattern } from './constants';
import { LogLevel } from '@amplitude/analytics-types';
import { UUID } from '@amplitude/analytics-core';
import { UUID, LogLevel } from '@amplitude/analytics-core';

describe('integration', () => {
const uuid: string = expect.stringMatching(uuidPattern) as string;
Expand Down
90 changes: 0 additions & 90 deletions packages/analytics-browser/src/attribution/campaign-parser.ts

This file was deleted.

4 changes: 1 addition & 3 deletions packages/analytics-browser/src/attribution/helpers.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
import { createIdentifyEvent, Identify, ILogger } from '@amplitude/analytics-core';
import { Campaign } from './campaign';
import { BASE_CAMPAIGN } from './constants';
import { createIdentifyEvent, Identify, ILogger, Campaign, BASE_CAMPAIGN } from '@amplitude/analytics-core';

export interface Options {
excludeReferrers?: (string | RegExp)[];
Expand Down
14 changes: 10 additions & 4 deletions packages/analytics-browser/src/attribution/web-attribution.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,14 @@
import { BrowserConfig, ILogger, Storage, getStorageKey, isNewSession } from '@amplitude/analytics-core';
import { Campaign } from './campaign';
import {
BrowserConfig,
ILogger,
Storage,
getStorageKey,
isNewSession,
Campaign,
CampaignParser,
BASE_CAMPAIGN,
} from '@amplitude/analytics-core';
import { Options, getDefaultExcludedReferrers, createCampaignEvent, isNewCampaign } from './helpers';
import { CampaignParser } from './campaign-parser';
import { BASE_CAMPAIGN } from './constants';

export class WebAttribution {
options: Options;
Expand Down
7 changes: 5 additions & 2 deletions packages/analytics-browser/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@ export {
DEFAULT_CSS_SELECTOR_ALLOWLIST,
DEFAULT_DATA_ATTRIBUTE_PREFIX,
DEFAULT_ACTION_CLICK_ALLOWLIST,
Campaign,
CampaignParser,
ClickIdParameters,
ReferrerParameters,
UTMParameters,
} from '@amplitude/analytics-core';

export { Campaign, CampaignParser, ClickIdParameters, ReferrerParameters, UTMParameters } from './attribution/campaign';
112 changes: 0 additions & 112 deletions packages/analytics-browser/test/attribution/campaign-parser.test.ts

This file was deleted.

3 changes: 1 addition & 2 deletions packages/analytics-browser/test/attribution/helpers.test.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
import { BASE_CAMPAIGN } from '../../src/attribution/constants';
import {
isNewCampaign,
createCampaignEvent,
getDefaultExcludedReferrers,
isExcludedReferrer,
} from '../../src/attribution/helpers';

import { getStorageKey } from '@amplitude/analytics-core';
import { getStorageKey, BASE_CAMPAIGN } from '@amplitude/analytics-core';

const loggerProvider = {
log: jest.fn(),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import { BASE_CAMPAIGN } from '../../src/attribution/constants';
import { CampaignParser } from '../../src/attribution/campaign-parser';
import { WebAttribution } from '../../src/attribution/web-attribution';
import {
FetchTransport,
Expand All @@ -9,6 +7,8 @@ import {
AttributionOptions,
BrowserConfig,
LogLevel,
BASE_CAMPAIGN,
CampaignParser,
} from '@amplitude/analytics-core';

describe('shouldTrackNewCampaign', () => {
Expand Down
Loading
Loading