Skip to content

Commit

Permalink
Merge pull request #78 from newfold-labs/add/paypal-sdk-attribution
Browse files Browse the repository at this point in the history
Add PayPal SDK Attribution
  • Loading branch information
circlecube authored May 4, 2023
2 parents 0e1ba43 + c02eabd commit 63cd5f9
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions bootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,5 +53,22 @@ function ( $parsed_args, $url ) {
10,
2
);

add_filter(
'script_loader_tag',
function ( $tag, $handle, $source ) {
if ( stripos( $source, 'paypal.com/sdk' ) !== false ) {
$replacement = ' data-partner-attribution-id="Yith_PCP"';
if ( stripos( $tag, 'partner-attribution-id' ) === false ) {
$tag = str_replace( ' src=', $replacement . ' src=', $tag );
} else if ( stripos( $tag, 'NEWFOLD' ) || stripos( $tag, 'YITH' ) ) {
$tag = preg_replace( '/ data-partner-attribution-id="(.*?)"/', $replacement, $tag );
}
}
return $tag;
},
25,
3
);

}

0 comments on commit 63cd5f9

Please sign in to comment.