Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug 1874901: add utm_source parameter to Red Hat Marketplace URLs for attribution #6363

Merged
merged 5 commits into from Sep 18, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -849,6 +849,18 @@ export const ClusterServiceVersionDetails: React.SFC<ClusterServiceVersionDetail
}
}

let supportWorkflowUrl;
if (marketplaceSupportWorkflow) {
try {
const url = new URL(marketplaceSupportWorkflow);
url.searchParams.set('utm_source', 'openshift_console');
supportWorkflowUrl = url.toString();
} catch (error) {
// eslint-disable-next-line no-console
console.error(error.message);
}
}

return (
<>
<ScrollToTopOnMount />
Expand Down Expand Up @@ -882,11 +894,11 @@ export const ClusterServiceVersionDetails: React.SFC<ClusterServiceVersionDetail
<dd>
{spec.provider && spec.provider.name ? spec.provider.name : 'Not available'}
</dd>
{marketplaceSupportWorkflow && (
{supportWorkflowUrl && (
<>
<dt>Support</dt>
<dd>
<ExternalLink href={marketplaceSupportWorkflow} text="Get support" />
<ExternalLink href={supportWorkflowUrl} text="Get support" />
</dd>
</>
)}
Expand Down
Expand Up @@ -138,6 +138,17 @@ export const OperatorHubItemDetails: React.SFC<OperatorHubItemDetailsProps> = ({
const mappedInfraFeatures = mappedData(infraFeatures);
const mappedValidSubscription = mappedData(validSubscription);

let supportWorkflowUrl;
if (marketplaceSupportWorkflow)
try {
const url = new URL(marketplaceSupportWorkflow);
url.searchParams.set('utm_source', 'openshift_console');
supportWorkflowUrl = url.toString();
} catch (error) {
// eslint-disable-next-line no-console
console.error(error.message);
}

return (
<div className="modal-body modal-body-border">
<div className="modal-body-content">
Expand Down Expand Up @@ -169,8 +180,8 @@ export const OperatorHubItemDetails: React.SFC<OperatorHubItemDetailsProps> = ({
<PropertyItem
label="Support"
value={
marketplaceSupportWorkflow ? (
<ExternalLink href={marketplaceSupportWorkflow} text="Get support" />
supportWorkflowUrl ? (
<ExternalLink href={supportWorkflowUrl} text="Get support" />
) : (
support || notAvailable
)
Expand Down
Expand Up @@ -421,6 +421,18 @@ export const OperatorHubTileView: React.FC<OperatorHubTileViewProps> = (props) =
detailsItem &&
`/k8s/ns/${detailsItem.subscription.metadata.namespace}/${SubscriptionModel.plural}/${detailsItem.subscription.metadata.name}?showDelete=true`;

let remoteWorkflowUrl = detailsItem?.marketplaceRemoteWorkflow;
if (remoteWorkflowUrl) {
try {
const url = new URL(remoteWorkflowUrl);
url.searchParams.set('utm_source', 'openshift_console');
remoteWorkflowUrl = url.toString();
} catch (error) {
// eslint-disable-next-line no-console
console.error(error.message);
}
}

if (_.isEmpty(filteredItems)) {
return (
<>
Expand Down Expand Up @@ -468,10 +480,10 @@ export const OperatorHubTileView: React.FC<OperatorHubTileViewProps> = (props) =
id="catalog-item-header"
/>
<div className="co-catalog-page__overlay-actions">
{detailsItem.marketplaceRemoteWorkflow && (
{remoteWorkflowUrl && (
<ExternalLink
additionalClassName="pf-c-button pf-m-primary co-catalog-page__overlay-action"
href={detailsItem.marketplaceRemoteWorkflow}
href={remoteWorkflowUrl}
text={
<>
<div className="co-catalog-page__overlay-action-label">
Expand All @@ -486,8 +498,8 @@ export const OperatorHubTileView: React.FC<OperatorHubTileViewProps> = (props) =
<Link
className={classNames(
'pf-c-button',
{ 'pf-m-secondary': detailsItem.marketplaceRemoteWorkflow },
{ 'pf-m-primary': !detailsItem.marketplaceRemoteWorkflow },
{ 'pf-m-secondary': remoteWorkflowUrl },
{ 'pf-m-primary': !remoteWorkflowUrl },
'co-catalog-page__overlay-action',
)}
data-test-id="operator-install-btn"
Expand Down