{"version":3,"file":"angulartics2-ibm-digital-analytics.js","sources":["ng://angulartics2/ibm-digital-analytics/ibm-digital-analytics.ts","ng://angulartics2/ibm-digital-analytics/angulartics2-ibm-digital-analytics.ts"],"sourcesContent":["import { Injectable } from '@angular/core';\r\nimport { Angulartics2 } from 'angulartics2';\r\n\r\n@Injectable({ providedIn: 'root' })\r\nexport class Angulartics2IBMDigitalAnalytics {\r\n constructor(private angulartics2: Angulartics2) {\r\n if (typeof window['cmCreatePageviewTag'] !== 'function') {\r\n console.warn(\r\n 'Angulartics 2 IBM Digital Analytics Plugin: eluminate.js is not loaded',\r\n );\r\n }\r\n }\r\n\r\n startTracking(): void {\r\n this.angulartics2.pageTrack\r\n .pipe(this.angulartics2.filterDeveloperMode())\r\n .subscribe(x => this.pageTrack(x.path));\r\n this.angulartics2.eventTrack\r\n .pipe(this.angulartics2.filterDeveloperMode())\r\n .subscribe(x => this.eventTrack(x.action, x.properties));\r\n }\r\n\r\n /**\r\n * Track Page in IBM Digital Analytics\r\n *\r\n * @param path location\r\n *\r\n * @link https://www.ibm.com/support/knowledgecenter/SSPG9M/Implementation/impl_pageviewtag.html\r\n */\r\n pageTrack(path: string) {\r\n const cmCreatePageviewTag = window['cmCreatePageviewTag'];\r\n cmCreatePageviewTag(path, null, null, null);\r\n }\r\n\r\n /**\r\n * Track an event in IBM Digital Analytics\r\n *\r\n * @param action A string corresponding to the type of event that needs to be tracked.\r\n * @param properties The properties that need to be logged with the event.\r\n */\r\n eventTrack(action: string, properties: any = {}) {\r\n const cmDisplayShops = window['cmDisplayShops'];\r\n switch (action) {\r\n /**\r\n * @description The Product View tag captures information about vdigitalDataiews of product detail pages.\r\n * The Product View tag should be called on the lowest level detail page for products, which is typically\r\n * the Product Details page. You can view example Product View tags below.\r\n *\r\n * @link https://www.ibm.com/support/knowledgecenter/SSPG9M/Implementation/impl_prodviewtag.html\r\n */\r\n case 'cmCreateProductviewTag':\r\n const cmCreateProductviewTag = window['cmCreateProductviewTag'];\r\n cmCreateProductviewTag(\r\n properties.productId,\r\n properties.productName,\r\n properties.categoryId,\r\n properties.attrbute,\r\n properties.virtualCategory,\r\n );\r\n\r\n break;\r\n\r\n /**\r\n * @description The Shop Action 5 tag captures data about selected products and which products are present in a shopping cart,\r\n * if any, when the cart is viewed.\r\n *\r\n * @link https://www.ibm.com/support/knowledgecenter/SSPG9M/Implementation/impl_shopact5tag.html\r\n */\r\n case 'cmCreateShopAction5Tag':\r\n const cmCreateShopAction5Tag = window['cmCreateShopAction5Tag'];\r\n cmCreateShopAction5Tag(\r\n properties.productId,\r\n properties.productName,\r\n properties.quantity,\r\n properties.unitPrice,\r\n properties.categoryId,\r\n properties.attrbute,\r\n properties.extraFields,\r\n properties.virtualCategory,\r\n );\r\n\r\n cmDisplayShops();\r\n\r\n break;\r\n\r\n /**\r\n * @description The Shop Action 9 tag captures data about what products were purchased by a customer.\r\n * Like the Shop Action 5 tag, one tag should be sent for each product line item purchased. These tags should be sent\r\n * on the receipt or other completion page confirming a successful order.\r\n *\r\n * @link https://www.ibm.com/support/knowledgecenter/SSPG9M/Implementation/impl_shopact9tag.html\r\n */\r\n case 'cmCreateShopAction9Tag':\r\n const cmCreateShopAction9Tag = window['cmCreateShopAction9Tag'];\r\n cmCreateShopAction9Tag(\r\n properties.productId,\r\n properties.productName,\r\n properties.quantity,\r\n properties.unitPrice,\r\n properties.registrationId,\r\n properties.orderId,\r\n properties.orderSubtotal,\r\n properties.categoryId,\r\n properties.attrbute,\r\n properties.extraFields,\r\n );\r\n\r\n cmDisplayShops();\r\n\r\n break;\r\n\r\n /**\r\n * @description The Order tag captures order header information such as Registration ID, order ID, order subtotal,\r\n * and shipping and handling. The Order tag should be sent on the receipt page confirming order completion.\r\n *\r\n * @link https://www.ibm.com/support/knowledgecenter/SSPG9M/Implementation/impl_ordertag.html\r\n */\r\n case 'cmCreateOrderTag':\r\n const cmCreateOrderTag = window['cmCreateOrderTag'];\r\n cmCreateOrderTag(\r\n properties.orderId,\r\n properties.orderSubtotal,\r\n properties.orderShipping,\r\n properties.registrationId,\r\n properties.registrantCity,\r\n properties.registrantState,\r\n properties.registrantPostalCode,\r\n properties.attrbute,\r\n properties.extraFields,\r\n );\r\n\r\n break;\r\n\r\n /**\r\n * @description The Registration tag creates a Lifetime Visitor Experience Profile (LIVE Profile) by associating a single\r\n * common Registration ID with the IBM® Digital Analytics permanent cookie set in every browser visiting the tagged site.\r\n *\r\n * @link https://www.ibm.com/support/knowledgecenter/SSPG9M/Implementation/impl_registrationtag.html\r\n */\r\n case 'cmCreateRegistrationTag':\r\n const cmCreateRegistrationTag = window['cmCreateRegistrationTag'];\r\n cmCreateRegistrationTag(\r\n properties.registrationId,\r\n properties.registrantEmail,\r\n properties.registrantCity,\r\n properties.registrantState,\r\n properties.registrantPostalCode,\r\n properties.registrantCountry,\r\n properties.attrbute,\r\n );\r\n\r\n break;\r\n\r\n /**\r\n * @description The Element tag is used to track intra-page content in IBM® Digital Analytics. Data collected by\r\n * the Element tag is used to populate values in the Element Categories and Top Viewed Elements reports.\r\n *\r\n * @link https://www.ibm.com/support/knowledgecenter/SSPG9M/Implementation/impl_elementtag.html\r\n */\r\n case 'cmCreateElementTag':\r\n const cmCreateElementTag = window['cmCreateElementTag'];\r\n cmCreateElementTag(\r\n properties.elementId,\r\n properties.elementCategory,\r\n properties.attrbute,\r\n );\r\n\r\n break;\r\n\r\n /**\r\n * @description The Conversion Event tag is employed for tracking of general non-commerce conversion events.\r\n * The Conversion Event tag is used to populate values in the Conversion Events Reports and to create Key Segments.\r\n * This tag and the reports it populates enable analysis of a wide variety of site activities.\r\n *\r\n * @link https://www.ibm.com/support/knowledgecenter/SSPG9M/Implementation/impl_conversioneventtag.html\r\n */\r\n case 'cmCreateConversionEventTag':\r\n const cmCreateConversionEventTag = window['cmCreateConversionEventTag'];\r\n cmCreateConversionEventTag(\r\n properties.eventId,\r\n properties.actionType,\r\n properties.eventCategoryId,\r\n properties.points,\r\n properties.attrbute,\r\n properties.extraFields,\r\n );\r\n\r\n break;\r\n\r\n default:\r\n console.warn('Unsupported Event Action');\r\n }\r\n }\r\n}\r\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './ibm-digital-analytics';\n"],"names":[],"mappings":";;;;;IAKE,yCAAoB,YAA0B;QAA1B,iBAAY,GAAZ,YAAY,CAAc;QAC5C,IAAI,OAAO,MAAM,CAAC,qBAAqB,CAAC,KAAK,UAAU,EAAE;YACvD,OAAO,CAAC,IAAI,CACV,wEAAwE,CACzE,CAAC;SACH;KACF;IAED,uDAAa,GAAb;QAAA,iBAOC;QANC,IAAI,CAAC,YAAY,CAAC,SAAS;aACxB,IAAI,CAAC,IAAI,CAAC,YAAY,CAAC,mBAAmB,EAAE,CAAC;aAC7C,SAAS,CAAC,UAAA,CAAC,IAAI,OAAA,KAAI,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,GAAA,CAAC,CAAC;QAC1C,IAAI,CAAC,YAAY,CAAC,UAAU;aACzB,IAAI,CAAC,IAAI,CAAC,YAAY,CAAC,mBAAmB,EAAE,CAAC;aAC7C,SAAS,CAAC,UAAA,CAAC,IAAI,OAAA,KAAI,CAAC,UAAU,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC,UAAU,CAAC,GAAA,CAAC,CAAC;KAC5D;;;;;;;;IASD,mDAAS,GAAT,UAAU,IAAY;QACpB,IAAM,mBAAmB,GAAG,MAAM,CAAC,qBAAqB,CAAC,CAAC;QAC1D,mBAAmB,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;KAC7C;;;;;;;IAQD,oDAAU,GAAV,UAAW,MAAc,EAAE,UAAoB;QAApB,2BAAA,EAAA,eAAoB;QAC7C,IAAM,cAAc,GAAG,MAAM,CAAC,gBAAgB,CAAC,CAAC;QAChD,QAAQ,MAAM;;;;;;;;YAQZ,KAAK,wBAAwB;gBAC3B,IAAM,sBAAsB,GAAG,MAAM,CAAC,wBAAwB,CAAC,CAAC;gB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